Window对象测试
版权声明:本文为博主原创文章,未经博主允许不得转载。 转载联系邮箱:1363119685@qq.com
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>window对象测试</title>
<script type="text/javascript" src="js/myjs03.js" ></script>
</head>
<body>
<input type="button" id="btn01" value="点击打开百度" />
</body>
</html>
JavaScript:
window.alert(123);
//窗体加载完成。执行匿名函数
window.onload=function(){
//根据id取元素btn01
var btn01=document.getElementById("btn01");
//给按钮绑定匿名函数
btn01.onclick=function(){
//window.open("http://www.baidu.com","_blank","height=380,width=320,toolbar=0,scrollbars=0,location=0,status=0,menubar=0,resizable=0");
window.close();
}
}
//执行一次
//setTimeout("alert('啦啦啦啦啦')",3000);
//执行无数次
setInterval("alert('啦啦啦啦啦啦')",3000);