Js controls the expand and close windows (display hidden layer)

Source: Internet
Author: User
Tip: you can modify some code before running

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Js controls the expand and close windows (display hidden layer)</title><meta http-equiv="content-type" content="text/html;charset=gb2312"><!--把下面代码加到<head>与</head>之间--><style type="text/css"># Box, # box2, # box3, # box4 {padding: 10px; border: 1px solid green ;}</style><script type="text/javascript">// = Click expand close result = function openShutManager (oSourceObj, oTargetObj, shutAble, oOpenTip, oShutTip) {var sourceObj = typeof oSourceObj = "string "? Document. getElementById (oSourceObj): oSourceObj; var targetObj = typeof oTargetObj = "string "? Document. getElementById (oTargetObj): oTargetObj; var openTip = oOpenTip | ""; var shutTip = oShutTip | ""; if (targetObj. style. display! = "None") {if (shutAble) return; targetObj. style. display = "none"; if (openTip & shutTip) {sourceObj. innerHTML = shutTip;} else {targetObj. style. display = "block"; if (openTip & shutTip) {sourceObj. innerHTML = openTip ;}}}</script></head><body><!--把下面代码加到<body>与</body>之间--><p>Click to expand</p><p id="box" >The box content is displayed here.</p><p>Click to expand</p><p id="box2" >The box content is displayed here.</p><p>Click to expand</p><p id="box3" >The box content is displayed here.</p><p><button onclick="openShutManager(this,'box4',false,'点击关闭','点击展开')">Click to expand</button></p><p id="box4" >The box content is displayed here.</p></body></html>
Tip: you can modify some code before running

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.