本文共 1369 字,大约阅读时间需要 4 分钟。
<!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="utf-8"/> |
| <title></title> |
| </head> |
| <body> |
| <input type="button" value="后退" οnclick="back()" /> |
| <input type="button" value="广告" οnclick="openadvert ('ad.html')" /> |
| <input type="button" value="关闭广告"οnclick="closeadvaert()" /> |
| <input type="button" value="开始广告自动弹出"οnclick="tanti()" /> |
| <input type="button" value="停止广告自动弹出"οnclick="closetanti()" /> |
| <input type="button" value="关闭本窗口"οnclick="clsetio()" /> |
| <input type="button" value="重新加载"οnclick="refresh()"/> |
| <input type="button" value="客户端信息"οnclick="getinfo()" /> |
| <script type="text/javascript"> |
| //广告 |
| var wino; |
| function openadvert (url) |
| { |
| wino=window.open(url,"advert"+Math.random(),"width=600,height=600,left=450,top=100,scrollbars=yes"); |
| } |
| //后退 |
| function back() |
| { |
| window.history.back();//后退 |
| |
| } |
| //关闭广告 |
| function closeadvaert() |
| { |
| if(wino) |
| { |
| wino.close(); |
| } |
| } |
| //停止自动弹出窗口 |
| function closetanti() |
| { |
| window.clearInterval(timer) ; |
| } |
| //开始自动弹出窗口 |
| var timer ; |
| function tanti() |
| { |
| timer = window.setInterval(function() |
| { |
| openadvert ('ad.html'); |
| },3000); |
| } |
| //关闭本窗口 |
| function clsetio() |
| { |
| window.close(); |
| } |
| //刷新 |
| function refresh() |
| { |
| window.location.reload(); |
| } |
| //客户端信息 |
| function getinfo() |
| { |
| alert("浏览器:"+window.navigator.appName+"\r\n" |
| +"版本:"+window.navigator.appVersion+"\r\n"+"操作系统:" |
| +window.navigator.platform) ; |
| } |
| |
| </script> |
| </body> |
| </html> |
转载于:https://www.cnblogs.com/yangxingxiu/p/4779902.html