学霸被老师罚的故事:浮动窗口的脚本文件在网页代码中应怎么设置?

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/05 15:15:26

第一个:
<script language="vbscript">
window.moveto 0,0
window.resizeto 100,100
wx=0
wy=0
dim tid
function mywindows()
if wx<window.screen.width-100 then

wx=wx+10
window.moveto wx,0

else
if wy<window.screen.width-100 then

wy=wy+10
window.move window.screen.width-100,wy
end if
end if

end function
tid=setinterval("mywindows()",10)
</script>

第2个:
<DIV id=ad style="POSITION: absolute"><A href="http://leifeng.gzbs.cn/"
target=_blank><IMG src="leifeng.gif" border=0></A></DIV>
<SCRIPT>
var x = 50,y = 60
var xin = true, yin = true
var step = 1
var delay = 10
var obj=document.getElementById("ad")
function floatAD() {
var L=T=0
var R= document.body.clientWidth-obj.offsetWidth
var B = document.body.clientHeight-obj.offsetHeight
obj.style.left = x + document.body.scrollLeft
obj.style.top = y + document.body.scrollTop
x = x + step*(xin?1:-1)
if (x < L) { xin = true; x = L}
if (x > R){ xin = false; x = R}
y = y + step*(yin?1:-1)
if (y < T) { yin = true; y = T }
if (y > B) { yin = false; y = B }
}
var itl= setInterval("floatAD()", delay)
obj.onmouseover=function(){clearInterval(itl)}
obj.onmouseout=function(){itl=setInterval("floatAD()", delay)}
</SCRIPT>
加在那都可以运行,最好加在<head></head>中间。