window对象中的常见方法

时间:2023-01-21 00:00:49

<body>
<!--
window对象中的常见方法
-->
<script type="text/javascript">

var timeid;
function windowMethodDemo(){
//var b = confirm("你真的确定点击吗?");
//alert("b="+b);
//setTimeout("alert('time run')",40);
timeid=setInterval("alert('time run')",400);
}

function stopTime(){
clearInterval(timeid);
}

function windowMove(){
//moveBy(10,10);
//移动窗口
//moveTo(40,40);

//震动窗口的代码
for(var x=0;x<700;x++){
moveBy(20,0);
moveBy(0,20);
moveBy(-20,0);
moveBy(0,-20);
}
}
//打开窗口
function windowOpen(){
open("http://www.baidu.com","_blank","height=200,width=400,status=yes,toolbar=yes,menubar=yes,location=yes");
}
</script>
<input type="button" value="演示window对象方法" onclick="windowMethodDemo()"/>
<input type="button" value="停止" onclick="stopTime()"/>
<input type="button" value="移动窗口" onclick="windowMove()"/>
<input type="button" value="打开窗口" onclick="windowOpen()"/>

</body>