展开关闭DIV

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="openorclosediv.aspx.cs" Inherits="openorclosediv" %>   
  2.   
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
  4. <html xmlns="http://www.w3.org/1999/xhtml" >   
  5. <head runat="server">   
  6. <style type="text/css">  
  7. #box4{padding:10px;border:1px solid green;}    
  8. </style>   
  9. <script type="text/javascript" language="javascript">   
  10. //=点击展开关闭效果=   
  11. function openShutManager(oSourceObj,oTargetObj,shutAble,oOpenTip,oShutTip){   
  12. var sourceObj = typeof oSourceObj == "string" ? document.getElementById(oSourceObj) : oSourceObj;   
  13. var targetObj = typeof oTargetObj == "string" ? document.getElementById(oTargetObj) : oTargetObj;   
  14. var openTip = oOpenTip || "";   
  15. var shutTip = oShutTip || "";   
  16. if(targetObj.style.display!="none"){   
  17.    if(shutAble) return;   
  18.    targetObj.style.display="none";   
  19.    if(openTip  &&  shutTip){   
  20.     sourceObj.innerHTML = shutTip; //修改button文字   
  21.    }   
  22. else {   
  23.    targetObj.style.display="block";   
  24.    if(openTip  &&  shutTip){   
  25.     sourceObj.innerHTML = openTip; //修改button文字   
  26.    }   
  27. }   
  28. }   
  29. </script>   
  30. <title>鼠标点击展开关闭层效果</title>   
  31. </head>   
  32. <body>   
  33.   
  34. <p><button onclick="openShutManager(this,'box4',false,'点击关闭','点击展开')">点击展开</button></p>   
  35. <div id="box4" style="display:none">   
  36.    这里是div中的内容-欢迎方法http://www.paomeng.com 精彩源码片段   
  37. </div>   
  38. </body>   
  39. </html>  

转载于:https://www.cnblogs.com/mengzi/archive/2009/03/30/1425203.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值