window 浏览器窗口对象, 不用创建就能使用
1.属性
status
opener
closed
parent 父窗体
top 顶层窗体
2.方法
alert();
confirm();
prompt();
var dt = setInterval('aaa()', 100);
clearInterval(dt);
var to =setTimeout('aaa()'.100);
clearTimeout(to);
open();
3.成员对象
document
screen
history
frame
location
...
实例:浮动广告
1.属性
status
opener
closed
parent 父窗体
top 顶层窗体
2.方法
alert();
confirm();
prompt();
var dt = setInterval('aaa()', 100);
clearInterval(dt);
var to =setTimeout('aaa()'.100);
clearTimeout(to);
open();
3.成员对象
document
screen
history
frame
location
...
实例:浮动广告
<html>
<head>
<style>
#one{
width:100px;
height:100px;
position:absolute;
background:#666;
text-align:center;
color:white;
}
</style>
</head>
<body>
<div id="one" style="left:0px;top:0px">我是广告</div>
<script>
var one = document.getElementById('one');
var vx = 5;
var vy = 5;
var x=0;
var y=0
function move(){
x = x + vx;
y = y + vy;
one.style.left = x;
one.style.top = y;
if(x + one.offsetWidth + 5> document.body.clientWidth || x<=0)
vx=-1*vx;
if(y + one.offsetHeight + 5> document.body.clientHeight || y<=0)
vy=-1*vy;
}
var dt = setInterval('move()',100);
one.onmouseover=function(){
clearInterval(dt)
}
one.onmouseout=function(){
dt=setInterval('move()',100);
}
</script>
</body>
</html>