- <!DOCTYPE HTML>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- <title>display</title>
- <script type="text/javascript">
- function hidetext()
- {
- var mychar = document.getElementById("con").style.display ="none";
-
- }
- function showtext()
- {
- var mychar = document.getElementById("con").style.display ="block";
-
- }
- </script>
- </head>
- <body>
- <h1>JavaScript</h1>
- <p id="con">做为一个Web开发师来说,如果你想提供漂亮的网页、令用户满意的上网体验,JavaScript是必不可少的工具。</p>
- <form>
- <input type="button" onclick="hidetext()" value="隐藏内容" />
- <input type="button" onclick="showtext()" value="显示内容" />
- </form>
- </body>
- </html>
<
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秒后再次弹窗
- function showtext()
- {
- var mychar = document.getElementById("bar1").style.display ="block";
-
- }
-
-
- setTimeout("showtext()",6000);
- function hidetext()
- {
- var mychar = document.getElementById("bar1").style.display ="none";
- setTimeout("showtext()",6000);
- }
-
-
- document.writeln("<style type=\'text/css\'>");
- document.writeln(".dialog{");
- document.writeln(" position: fixed;");
- document.writeln(" _position:absolute;");
- document.writeln(" z-index:999999;");
- document.writeln(" top: 50%;");
- document.writeln(" left: 50%;");
- document.writeln(" display: none;");
- document.writeln(" margin: -135px 0 0 -140px;");
- document.writeln(" width: 280px;");
- document.writeln(" height:270px;");
- document.writeln(" background:#339933;");
- document.writeln("} ");
- document.writeln(".guanbi{ top:0px; height:25px; width:30px; right:0px; position:absolute;
-
-
- cursor:pointer}");
- document.writeln("</style>");
- document.writeln("<div class=\'dialog\' id=\'bar1\'><span class=\'guanbi\' οnclick=\'hidetext()\'></span><a href=\'/swt/\'><img src=\'/swt/1.gif\'/></a></div>");