js点击显示隐藏

  1. <!DOCTYPE HTML>  
  2. <html>  
  3. <head>  
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">  
  5. <title>display</title>  
  6.     <script type="text/javascript">   
  7.         function hidetext()    
  8.         {    
  9.         var mychar = document.getElementById("con").style.display ="none";  
  10.           
  11.         }    
  12.         function showtext()    
  13.         {    
  14.         var mychar = document.getElementById("con").style.display ="block";  
  15.           
  16.         }  
  17.     </script>   
  18. </head>   
  19. <body>    
  20.     <h1>JavaScript</h1>    
  21.     <p id="con">做为一个Web开发师来说,如果你想提供漂亮的网页、令用户满意的上网体验,JavaScript是必不可少的工具。</p>   
  22.     <form>  
  23.        <input type="button" onclick="hidetext()" value="隐藏内容" />   
  24.        <input type="button" onclick="showtext()" value="显示内容" />   
  25.     </form>  
  26. </body>   
  27. </html>  

      <!-- -_-|| 偷懒就写个body -->
         < div  onClick = "javascript: func()" >消失</ div >
         < span  id = "kkkw" >哇哈哈哇哈哈哇哈哈</ span >
         
         < script  language = "javascript" >
             var kkkw = document.getElementById("kkkw");
             kkkw.style.display = "block";
             function func() {
                 if(kkkw.style.display == "block")
                     kkkw.style.display = "none";
                 else
                     kkkw.style.display = "block";
             }
         </ script >
     </ body >


商务通弹窗修改,打开网页5秒后弹窗,点击关闭,5秒后再次弹窗

[javascript]  view plain  copy
  1. function showtext()    
  2. {    
  3. var mychar = document.getElementById("bar1").style.display ="block";  
  4.                 
  5.         }  
  6.   
  7.   
  8. setTimeout("showtext()",6000);//6秒   
  9.   function hidetext()    
  10. {    
  11. var mychar = document.getElementById("bar1").style.display ="none";  
  12.                 setTimeout("showtext()",6000);//6秒    
  13. }    
  14.   
  15.   
  16. document.writeln("<style type=\'text/css\'>");  
  17. document.writeln(".dialog{");  
  18. document.writeln(" position: fixed;");  
  19. document.writeln(" _position:absolute;");  
  20. document.writeln(" z-index:999999;");  
  21. document.writeln(" top: 50%;");  
  22. document.writeln(" left: 50%;");  
  23. document.writeln(" display: none;");  
  24. document.writeln(" margin: -135px 0 0 -140px;");  
  25. document.writeln(" width: 280px;");  
  26. document.writeln(" height:270px;");  
  27. document.writeln(" background:#339933;");  
  28. document.writeln("} ");  
  29. document.writeln(".guanbi{ top:0px; height:25px; width:30px; right:0px; position:absolute;   
  30.   
  31.   
  32. cursor:pointer}");  
  33. document.writeln("</style>");  
  34. document.writeln("<div class=\'dialog\' id=\'bar1\'><span class=\'guanbi\' οnclick=\'hidetext()\'></span><a href=\'/swt/\'><img src=\'/swt/1.gif\'/></a></div>");  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值