javascript,window对象,window对象案例,window对象的使用
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>javascript,window对象,window对象案例,window对象的使用,雪豹软件工作室</title>
<script type="text/javascript">
//window.confirm("请确定删除吗?");
//alert(window.screen.availWidth + " " + screen.availHeight);
//alert("sss");
//window.open("http://www.baidu.com", "我的百度", "", false);
//var myName = "jack";
//alert(window.myName);
//window.prompt("hello", "world");
function closeDemo(){
//alert("关闭当前页面!");
//close();
//window.open(' ','_self');
//window.close();
//window.open("about:blank","_self").close();
//window.open("","_self").close();
//window.open("about:blank","_self");
//window.close();
//open(' ', '_self').close();
/* var userAgent = navigator.userAgent;
alert(userAgent);
//return false;
if (userAgent.indexOf("Firefox") != -1
|| userAgent.indexOf("Chrome") != -1) {
window.location.href = "about:blank";
} else {
window.opener = null;
window.open("", "_self");
window.close();
} */
//window.open('', 'test').close();
/* setTimeout(function(){
window.open(' ', '_self', '');
window.close();
}, 100); */
// var number = Math.random();
// console.log(number);
// window.open ("http://www.baidu.com", "myWiddown" + number);
//经测试,close()函数,在IE浏览器,火狐浏览器中都可以正常关闭窗口,暂不支持谷歌浏览器(测试时间:2017-08-24)
/* if (window.confirm("您确定要关闭窗口吗?")) {
window.close();
} */
window.close();
}
function showModalDialogDemo() {
//window.showModalDialog()函数,只支持IE浏览器和火狐浏览器,不支持谷歌浏览器(测试时间:2017-08-24)
//window.showModalDialog("calculator.html");
//showModelessDialog()函数只支持IE浏览器,不支持谷歌浏览器和火狐浏览器(测试时间:2017-08-24)
window.showModelessDialog("calculator.html");
status = "hello";
}
</script>
</head>
<body>
<input type="button" value="close" onclick="closeDemo()"><br><br>
<input type="button" value="showModalDialog" onclick="showModalDialogDemo()"><br><br>
<h3><font color="red">测试超链接的target属性(target="_top"和target="_parent"没有具体去深究,有时间再研究_parent和_top这2个值)</font></h3>
<h4><font color="blue">超链接a的target属性知识,可参考如下网址</font></h4>
<a href="https://wenku.baidu.com/view/cf0b0f49ac02de80d4d8d15abe23482fb4da020a.html" target="test1">
https://wenku.baidu.com/view/cf0b0f49ac02de80d4d8d15abe23482fb4da020a.html
</a><br><br>
<a href="http://www.cnblogs.com/starof/p/4014691.html" target="test2">
http://www.cnblogs.com/starof/p/4014691.html
</a><br><br>
<hr>
<a href="calculator.html" target="helloWorld">计算器页面链接</a><br><br>
<a href="http://www.soso.com" target="helloWorld">soso页面链接</a><br><br>
<a href="http://cn.bing.com" target="helloWorld">微软必应</a><br><br>
<a href="http://cn.bing.com" target="_self">测试_self</a><br><br>
<a href="http://cn.bing.com" target="_blank">测试_blank</a><br><br>
<a href="http://cn.bing.com" target="_new">测试_new</a><br><br>
<a href="http://cn.bing.com">默认target属性为_self</a><br><br>
<a href="http://cn.bing.com" target="_top">测试_top</a><br><br>
<a href="http://cn.bing.com" target="_parent">测试_parent</a><br><br>
</body>
</html>