页面上可关闭的浮动广告
<P>样例代码</P><P><FONT color=#ff0000></FONT></P><P><script language="javascript"><BR>function showtime(){<BR>currtime.innerText=new Date().toLocaleString();<BR>setTimeout("showtime()",1000)<BR>}<BR>window.attachEvent("onload",showtime)<BR></script><BR><html><BR><body><BR><script language="JavaScript"><BR>var delta=0.15<BR>var collection;<BR>function floaters() {<BR>this.items = [];<BR>this.addItem = function(id,x,y,content)<BR>{<BR>document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>');</P><P>var newItem = {};<BR>newItem.object = document.getElementById(id);<BR>newItem.x = x;<BR>newItem.y = y; <BR>this.items = newItem;<BR>}<BR>this.play = function()<BR>{<BR>collection = this.items<BR>setInterval('play()',10);<BR>}<BR>}<BR>function play()<BR>{<BR>if(screen.width<=800)<BR>{<BR>for(var i=0;i<collection.length;i++)<BR>{<BR>collection.object.style.display = 'none';<BR>}<BR>return;<BR>}<BR>for(var i=0;i<collection.length;i++)<BR>{<BR>var followObj = collection.object;<BR>var followObj_x = (typeof(collection.x)=='string'?eval(collection.x):collection.x);<BR>var followObj_y = (typeof(collection.y)=='string'?eval(collection.y):collection.y); <BR>if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {<BR>var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;<BR>dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));<BR>followObj.style.left=followObj.offsetLeft+dx;<BR>} <BR>if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {<BR>var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;<BR>dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));<BR>followObj.style.top=followObj.offsetTop+dy;<BR>}<BR>followObj.style.display = '';<BR>}<BR>} </P><P>var theFloaters = new floaters();<BR>theFloaters.addItem('followDiv1','document.body.clientWidth-106',80,'<br><EMBED src="<A href="http://ad4.sina.com.cn/200510/25/34664_elong100300_l.swf">http://ad4.sina.com.cn/200510/25/34664_elong100300_l.swf</A> " id="veicon" quality=high PLUGINSPAGE="<A href="http://www.macromedia.com/go/getflashplayer">http://www.macromedia.com/go/getflashplayer</A>" TYPE="application/x-shockwave-flash" WIDTH="100" HEIGHT="300"></EMBED>');<BR>theFloaters.play(); <BR></script></P><P><BR><SCRIPT FOR='veicon' EVENT='FSCommand()' LANGUAGE='JavaScript'><BR>followDiv1.style.visibility='hidden';</P><P></script><BR><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><BR></body><BR></html></P><P><FONT color=#ff0000></FONT></P>
页:
[1]