标签:
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title></title> | |
</head> | |
<body> | |
<input type="button" value="后退" onclick="back()" /> | |
<input type="button" value="广告" onclick="openadvert (‘ad.html‘)" /> | |
<input type="button" value="关闭广告"onclick="closeadvaert()" /> | |
<input type="button" value="开始广告自动弹出"onclick="tanti()" /> | |
<input type="button" value="停止广告自动弹出"onclick="closetanti()" /> | |
<input type="button" value="关闭本窗口"onclick="clsetio()" /> | |
<input type="button" value="重新加载"onclick="refresh()"/> | |
<input type="button" value="客户端信息"onclick="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> |
标签:
原文地址:http://www.cnblogs.com/yangxingxiu/p/4779902.html