阅读:4619回复:6
W3C支持浮标吗?支持的话,JS应如何书写?![]() 这代码在W3C是不动的。 <script language="javascript1.1" type="text/javascript"> var adSrc5 = "80.gif" var adUrl5 = "#" var adWidth5 = "80" var adHeight5 = "80" // change var var weny5 = 10 var wenx5 = 10 document.ns = navigator.appName == "Netscape" function load5() { if (navigator.appName == "Netscape") { document.adfloat.screenY=pageYOffset+window.innerHeight-adHeight5-weny5; document.adfloat.screenX=wenx5; move5(); } else { document.getElementById("adfloat").style.top=document.body.scrollTop+document.body.offsetHeight-adHeight5-weny5-20; document.getElementById("adfloat").style.left=wenx5; move5(); } } function move5() { if(document.ns) { document.adfloat.top=pageYOffset+window.innerHeight-adHeight5-weny5; document.adfloat.left=wenx5; setTimeout("move5();",80) } else { document.getElementById("adfloat").style.top=document.body.scrollTop+document.body.offsetHeight-adHeight5-weny5-20; document.getElementById("adfloat").style.left=wenx5; setTimeout("move5();",80) } } function MM_reloadPage5(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) { if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage5; } } else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage5(true) if (navigator.appName == "Netscape") { document.write("<layer id=\"adfloat\" top=\"300\" width=\" + adWidth5 + \" height=" + adHeight5 + " ><a href=" + adUrl5 + " target=_blank><img src=" + adSrc5 + " border=0 width=" + adWidth5 + " height=" + adHeight5 + "></a></layer>"); load5(); } else { document.write("<div id=\"adfloat\" style='top:300; position: absolute; width:" + adWidth5 + ";'><a href=" + adUrl5 + " target=_blank><img src=" + adSrc5 + " border=0 width=" + adWidth5 + " height=" + adHeight5 + "></a></div>"); load5(); } </script> |
|
1楼#
发布于:2005-07-05 15:35
如何在一个屏幕上上下浮动?
就是说,比如页面高度大于一屏时,浮标只是在可见区域上上下浮动? |
|
2楼#
发布于:2005-07-05 15:35
把 "wenx5" 设为 0 便只会上下浮动。
hehe! 树大招风,广告商也开始对 FF 作 "优化" 了。 ![]() |
|
|
3楼#
发布于:2005-07-05 15:35
非常感激!
非常感谢你的回复!
还有一点就是:我只要上下垂直浮动。 |
|
4楼#
发布于:2005-07-05 15:35
纯粹交流用途
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <script language="javascript1.1" type="text/javascript"> var adSrc5 = "80.gif" var adUrl5 = "test.html" var adWidth5 = "80" var adHeight5 = "80" var weny5 = 2 var wenx5 = 2 var randomID = Math.random().toString().substr(4,parseInt(Math.random().toString().charAt(4))+6); function load5() { document.getElementById(randomID).style.top='0px'; document.getElementById(randomID).style.left='0px'; move5(); } function move5() { document.getElementById(randomID).style.top=parseInt(document.getElementById(randomID).style.top)+weny5+'px'; if(parseInt(document.getElementById(randomID).style.top)+document.getElementById(randomID).offsetHeight>(document.body.clientHeight?document.body.clientHeight:document.documentElement.clientHeight)){ document.getElementById(randomID).style.top=(document.body.clientHeight?document.body.clientHeight:document.documentElement.clientHeight)-document.getElementById(randomID).offsetHeight+'px'; weny5*=-1; } if(parseInt(document.getElementById(randomID).style.top)<0){ document.getElementById(randomID).style.top='0px'; weny5*=-1; } document.getElementById(randomID).style.left=parseInt(document.getElementById(randomID).style.left)+wenx5+'px'; if(parseInt(document.getElementById(randomID).style.left)+document.getElementById(randomID).offsetWidth>(document.body.clientWidth?document.body.clientWidth:document.documentElement.clientWidth)){ document.getElementById(randomID).style.left=(document.body.clientWidth?document.body.clientWidth:document.documentElement.clientWidth)-document.getElementById(randomID).offsetWidth+'px'; wenx5*=-1; } if(parseInt(document.getElementById(randomID).style.left)<0){ document.getElementById(randomID).style.left='0px'; wenx5*=-1; } setTimeout("move5();",20) } document.write("<span id=\""+randomID+"\" onclick=this.removeNode(true) style=\"background-color:brown; overflow:hidden; top:0px; left:0px; position:absolute; width:" + adWidth5 + "; height:" + adHeight5 + "\" ><a href=" + adUrl5 + " target=_blank><img src=" + adSrc5 + " border=0 width=" + adWidth5 + " height=" + adHeight5 + "></a><a style=\"color: white; font-weight:700; font:18px Tahoma; width:" + adWidth5 + "; height:"+ adHeight5 + "\" href=" + adUrl5 + " target=_blank>浮动广告<br>浮动广告<br>浮动广告</a></span>"); load5() </script> </body> </html> 特点: 1. 兼容 FF,opera,IE (但个别 IE shell 有超级浮动广告过滤插件,这类浮动广告最多只能维持在半秒钟便会被自动删除); 2. 基本上兼容任何标准或非标准页面; 3. 广告 id 由动态产生,不会轻易被 CSS 玩意隐藏 (示范用的是长短不一的 random 数字,可以再另加插字母防止 x-path); 4. 具后备文字广告链接。只要把脚本即接写入页面(不使用外置 js 档案),adblock 等内容过滤最多只能屏蔽图案,仍然能维持文字浮动广告。 |
|
|
5楼#
发布于:2005-07-05 15:35
呵呵! 既然楼主有心为 FF 优化,让 FF 用户也能享受 IE 用户的体验,我来帮你。
|
|
|
6楼#
发布于:2005-07-05 15:35
有可能不兼容。。
|
|