对联广告代码(求网站左右空白地方悬浮对联广告代码,可以上下移动的那种)
本文目录
- 求网站左右空白地方悬浮对联广告代码,可以上下移动的那种
- 求一个对联广告代码
- 一个对联广告代码,请高手帮忙修改成一下,80分送上
- 对联广告代码~
- 网站Flash对联广告源代码
- 网站主页怎么添加对联广告代码啊添加到哪里是新建个html还是怎么办啊
- 浮动对联广告代码 兼容if,firefox
- 想要个带关闭的随动对联广告代码,可以自己更换代码广告的那种 js 或asp的都可以
- 怎么写带关闭的网页广告对联代码,是网页两侧的那种
求网站左右空白地方悬浮对联广告代码,可以上下移动的那种
先在你的网站主目录建立JS文件,再建立一个JS文件(如ad-01.js)打开文本将下面代码复制到其中,保存格式为jsfunction initEcAd() {document.all.AdLayer1.style.posTop = -200;document.all.AdLayer1.style.visibility = ’visible’document.all.AdLayer2.style.posTop = -200;document.all.AdLayer2.style.visibility = ’visible’MoveLeftLayer(’AdLayer1’);MoveRightLayer(’AdLayer2’);}function MoveLeftLayer(layerName) {var x = 5;var y = 100;// 左侧广告距离页首高度var diff = (document.body.scrollTop + y - document.all.AdLayer1.style.posTop)*.40;var y = document.body.scrollTop + y - diff;eval("document.all." + layerName + ".style.posTop = parseInt(y)");eval("document.all." + layerName + ".style.posLeft = x");setTimeout("MoveLeftLayer(’AdLayer1’);", 20);}function MoveRightLayer(layerName) {var x = 5;var y = 100;// 右侧广告距离页首高度var diff = (document.body.scrollTop + y - document.all.AdLayer2.style.posTop)*.40;var y = document.body.scrollTop + y - diff;eval("document.all." + layerName + ".style.posTop = y");eval("document.all." + layerName + ".style.posRight = x");setTimeout("MoveRightLayer(’AdLayer2’);", 20);}***隐藏网址******隐藏网址***initEcAd()// JavaScript Document还没结束呢,,然后将 《script src="js/ad-01.js" language="JavaScript"》《/script》放在body中。就OK了,还不明白就加我QQ:9142673。我指导你。。
求一个对联广告代码
复制下面代码放到js文件里就行了 导入用《script language="javascript" src="你的js文件名.js"》《/script》放到你的首页就可以了 你应该满意这段代码的效果吧 兼容firefoxf/ie/chrome以下是js文件代码直接复制即可: lastScrollY=0;function heartBeat(){var diffY;if (document.documentElement && document.documentElement.scrollTop)diffY = document.documentElement.scrollTop;else if (document.body)diffY = document.body.scrollTopelse{/*Netscape stuff*/}//alert(diffY);percent=.1*(diffY-lastScrollY);if(percent》0)percent=Math.ceil(percent);else percent=Math.floor(percent);document.getElementById("LeftAd").style.top=parseInt(document.getElementById("LeftAd").style.top)+percent+"px";document.getElementById("RightAd").style.top=parseInt(document.getElementById("LeftAd").style.top)+percent+"px";lastScrollY=lastScrollY+percent;//alert(lastScrollY);}***隐藏网址******隐藏网址***document.write(suspendcode12);document.write(suspendcode14);window.setInterval("heartBeat()",1);function ClosedivLeft(){LeftAd.style.visibility="hidden";}function ClosedivRight(){RightAd.style.visibility="hidden";}代码已经优化了,别告诉我你这还看不懂。
一个对联广告代码,请高手帮忙修改成一下,80分送上
《SCRIPT LANGUAGE="JavaScript"》《!-- // 对联广告代码开始var showad = true; //是否显示广告var Toppx = 105; //上端位置var AdDivW = 100; //宽度var AdDivH = 300; //高度var PageWidth = 1024; //页面多少宽度象素下正好不出现左右滚动条var MinScreenW = 1024; //显示广告的最小屏幕宽度象素var ClosebuttonHtml = ’《div align="right" style="position: absolute;top:0px;right:0px; margin:0px;padding:0px;z-index:2000;"》《a href="javascript:;" onclick="hidead()" style="color:#0066ff;text-decoration:none;font-size:12px;"》关闭《/a》《/div》’var AdContentHtml1 = ’《img border="0" src="Images/duilian.jpg"》’; //指定左侧的广告图片位置var AdContentHtml2 = ’《img border="0" src="Images/duilian.jpg"》’; //指定右侧的广告图片位置document.write (’《div id="Javascript.LeftDiv" style="position: absolute;border: 1px solid #336699;background-color:#EEEEE2;z-index:1000; left;5px; width:’+AdDivW+’px;height:’+AdDivH+’px;top:-1000px;word-break:break-all;display:none;"》’+ClosebuttonHtml+’《div》’+AdContentHtml1+’《/div》《/div》’);document.write (’《div id="Javascript.RightDiv" style="position: absolute;border: 1px solid #336699;background-color:#EEEEE2;z-index:1000;width:’+AdDivW+’px;height:’+AdDivH+’px;top:-1000px;word-break:break-all;display:none;"》’+ClosebuttonHtml+’《div》’+AdContentHtml2+’《/div》《/div》’);function scall(){ if(!showad){return;} if (window.screen.width《MinScreenW){ //alert("临时提示:nn显示器分辨率宽度小于"+MinScreenW+",不显示广告"); showad = false; document.getElementById("Javascript.LeftDiv").style.display="none"; document.getElementById("Javascript.RightDiv").style.display="none"; return; } var Borderpx = ((window.screen.width-PageWidth)/2-AdDivW)/2; document.getElementById("Javascript.LeftDiv").style.display=""; document.getElementById("Javascript.LeftDiv").style.top=(document.documentElement.scrollTop+Toppx)+"px"; document.getElementById("Javascript.LeftDiv").style.left=(document.documentElement.scrollLeft+Borderpx)+"px"; document.getElementById("Javascript.RightDiv").style.display=""; document.getElementById("Javascript.RightDiv").style.top=(document.documentElement.scrollTop+Toppx)+"px"; document.getElementById("Javascript.RightDiv").style.left=(document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementById("Javascript.RightDiv").offsetWidth-Borderpx)+"px";}function hidead(){ showad = false; document.getElementById("Javascript.LeftDiv").style.display="none"; document.getElementById("Javascript.RightDiv").style.display="none";}window.onscroll=scall;window.onresize=scall;window.onload=scall;//--》 //对联广告代码结束《/SCRIPT》
对联广告代码~
CODE: var delta=0.015 var collection; function floaters() { this.items = ; this.addItem = function(id,x,y,content) { document.write(’《DIV id=’+id+’ style="Z-INDEX: 0; POSITION: absolute; width:80px; height:60px;left:’+(typeof(x)==’string’?eval(x):x)+’;top:’+(typeof(y)==’string’?eval(y):y)+’"》’+content+’《/DIV》’); var newItem = {}; newItem.object = document.getElementById(id); newItem.x = x; newItem.y = y; this.items = newItem; } this.play = function() { collection = this.items setInterval(’play()’,10); } } function play() { if(screen.width《=800) { for(var i=0;i《collection.length;i++) { collection.object.style.display = ’none’; } return; } for(var i=0;i《collection.length;i++) { var followObj = collection.object; var followObj_x = (typeof(collection.x); var followObj_y = (typeof(collection.y); if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) { var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta; dx=(dx》0?1:-1)*Math.ceil(Math.abs(dx)); followObj.style.left=followObj.offsetLeft+dx; } if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) { var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta; dy=(dy》0?1:-1)*Math.ceil(Math.abs(dy)); followObj.style.top=followObj.offsetTop+dy; } followObj.style.display = ’’; } } var theFloaters = new floaters(); theFloaters.addItem(’followDiv1’,’document.body.clientWidth-100’,0,’《/a》《br》《a href=广告链接地址 target=_blank》《img src=广告图片地址 width=100 height=400 border=0》《/a》’); theFloaters.addItem(’followDiv2’,0,0,’《br》《a href=广告链接地址 target=_blank》《img src=广告图片地址 width=100 height=400 border=0》《/a》’); theFloaters.play(); 把上面的代码另存为一个JS文件,然后在想实现此效果的页面用 调用即可!注意修改广告图片地址和连接地址! 与前面一个代码不同的是,当鼠标移动到广告图片上是可以感应显示另外设置好的广告大图效果,下面就是实现效果所需代码:CODE:function bigshow(){document.all.div_250.style.visibility = ’visible’;document.all.div_80.style.visibility = ’hidden’;}function bighide(){document.all.div_80.style.visibility = ’visible’;document.all.div_250.style.visibility = ’hidden’;}var ad_80= new Array(1);var ad_250= new Array(1);***隐藏网址******隐藏网址***var imgheight;var fubioleft;window.screen.width》800 ? fubioleft=15:fubioleft=15document.write(’《DIV id=floater_left style="Z-INDEX: 25; LEFT:’+fubioleft+’px; WIDTH: 28px;POSITION: absolute; TOP: 42px; HEIGHT: 22px"》’);ad_now = new Date();ad_id= ad_now.getSeconds() %1var adhead1="《div id=div_80 style=’position:absolute; width:95px; height:62px; z-index:12’ onMouseOver=bigshow();》";var adhead2="《/div》《div id=div_250 style=’position:absolute; visibility: hidden; z-index:13;width: 80; height: 60’ onMouseOut=bighide();》";//var adhead1="《div id=div_80 style=’position:absolute; width:95px; height:62px; z-index:20’ onMouseOut=’//MM_showHideLayers(\"div_250\",\"\",\"hide\")’ onMouseOver=’MM_showHideLayers(\"div_250\",\"\",\"show\")’》";//var adhead2="《/div》《div id=div_250 style=’position:absolute; z-index:21;visibility: hidden; width: 80; height: 60’ onMouseOver=’MM_showHideLayers(\"div_250\",\"\",\"show\")’ onMouseOut=’MM_showHideLayers(\"div_250\",\"\",\"hide\")’》";document.write(adhead1+ad_80+"《/div》");document.write ("《/div》");self.onError=null;currentX = currentY = 0; whichIt = null; lastScrollX = 0; lastScrollY = 0; NS = (document.layers) ? 1 : 0; IE = (document.all) ? 1: 0; function heartBeat() { if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; } if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; } if(diffY != lastScrollY) { percent = .5 * (diffY - lastScrollY); if(percent 》 0) percent = Math.ceil(percent); else percent = Math.floor(percent); if(IE) document.all.floater_left.style.pixelTop += percent; if(NS) document.floater_left.top += percent; lastScrollY = lastScrollY + percent; } if(diffX != lastScrollX) { percent = .5 * (diffX - lastScrollX); if(percent 》 0) percent = Math.ceil(percent); else percent = Math.floor(percent); if(IE) document.all.floater_left.style.pixelLeft += percent; if(NS) document.floater_left.left += percent; lastScrollX = lastScrollX + percent; } } if(NS || IE) action = window.setInterval("heartBeat()",1);var ad_80= new Array(1);var ad_250= new Array(1);***隐藏网址******隐藏网址***var imgheight;var fubioleft;window.screen.width》800 ? fubioleft=15:fubioleft=15document.write(’《DIV id=floater_right style="Z-INDEX: 25; LEFT:’+fubioleft+’px; WIDTH: 28px;POSITION: absolute; TOP: 42px; HEIGHT: 22px"》’);ad_now = new Date();ad_id= ad_now.getSeconds() %1function myload(){if (navigator.appName == "Netscape"){document.div_right_80.pageX=+window.innerWidth-130;document.div_right_250.pageX=+window.innerWidth-300;mymove();}else{div_right_80.style.left=document.body.offsetWidth-130;div_right_250.style.left=document.body.offsetWidth-300;mymove();}}function mymove(){if(document.ns){document.div_right_80.left=pageXOffset+window.innerWidth-130;document.div_right_250.left=pageXOffset+window.innerWidth-300;setTimeout("mymove();",20)}else{div_right_80.style.left=document.body.scrollLeft+document.body.offsetWidth-145;div_right_250.style.left=document.body.scrollLeft+document.body.offsetWidth-300;setTimeout("mymove();",20)}}var adhead1="《div id=div_right_80 style=’position:absolute; width:95px; height:60px; z-index:12’ onMouseOver=bigshow_right();》";var adhead2="《/div》《div id=div_right_250 style=’position:absolute; visibility: hidden; z-index:13;width: 250; height: 250’ onMouseOut=bighide_right();》《div align=right》";document.write(adhead1+ad_80+"《/div》《/div》");myload()document.write ("《/div》");self.onError=null;currentX_right = currentY_right = 0; whichIt_right = null; lastScrollX_right = 0; lastScrollY_right = 0; NS = (document.layers) ? 1 : 0; IE = (document.all) ? 1: 0; function heartBeat_right() { if(IE) { diffY_right = document.body.scrollTop; diffX_right = document.body.scrollLeft; } if(NS) { diffY_right = self.pageYOffset; diffX_right = self.pageXOffset; } if(diffY_right != lastScrollY_right) { percent_right = .5 * (diffY_right - lastScrollY_right); if(percent_right 》 0) percent_right = Math.ceil(percent_right); else percent_right = Math.floor(percent_right); if(IE) document.all.floater_right.style.pixelTop += percent_right; if(NS) document.floater_right.top += percent_right; lastScrollY_right = lastScrollY_right + percent_right; } if(diffX_right != lastScrollX_right) { percent_right = .5 * (diffX_right - lastScrollX_right); if(percent_right 》 0) percent_right = Math.ceil(percent_right); else percent_right = Math.floor(percent_right); if(IE) document.all.floater_right.style.pixelLeft += percent_right; if(NS) document.floater_right.left += percent_right; lastScrollX_right = lastScrollX_right + percent_right; } } if(NS || IE) action = window.setInterval("heartBeat_right()",1);function bigshow_right(){document.all.div_right_250.style.visibility = ’visible’;document.all.div_right_80.style.visibility = ’hidden’;}function bighide_right(){document.all.div_right_80.style.visibility = ’visible’;document.all.div_right_250.style.visibility = ’hidden’;}document.write(’’);document.write(’’);document.write(’’);把上面的代码另存为一个JS文件,然后在想实现此效果的页面用CODE:《script type="text/javascript" language="javascript1.2" src="*.js"》《/SCRIPT》调用即可,*代表你另存的文件名!注意修改广告图片地址和连接地址! 与前面两个代码不同的是,广告图下方增加了一个图片按纽,允许访客点击关闭广告图片,下面文本框中就是实现效果所需代码:CODE:var delta=0.015;var collection;var closeB=false;function floaters() { this.items = ; this.addItem = function(id,x,y,content) { 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》’); var newItem = {}; newItem.object = document.getElementById(id); newItem.x = x; newItem.y = y; this.items = newItem; } this.play = function() { collection = this.items setInterval(’play()’,30); } } function play() { if(screen.width《=800 || closeB) { for(var i=0;i《collection.length;i++) { collection.object.style.display = ’none’; } return; } for(var i=0;i《collection.length;i++) { var followObj = collection.object; var followObj_x = (typeof(collection.x); var followObj_y = (typeof(collection.y); if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) { var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta; dx=(dx》0?1:-1)*Math.ceil(Math.abs(dx)); followObj.style.left=followObj.offsetLeft+dx; } if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) { var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta; dy=(dy》0?1:-1)*Math.ceil(Math.abs(dy)); followObj.style.top=followObj.offsetTop+dy; } followObj.style.display = ’’; } } function closeBanner() { closeB=true; return; }var theFloaters = new floaters();//***隐藏网址******隐藏网址***theFloaters.play();把上面的代码另存为一个JS文件,然后在想实现此效果的页面用 调用即可,*代表你另存的文件名!注意修改广告图片地址和连接地址! 浮动对联广告---之左侧代码如果您想只有一侧显示的话,下面是实现左侧效果所需代码:CODE:var ad_float_left_src ="图片地址";var ad_float_left_url ="地址";var ad_float_left_type = "";document.ns = navigator.appName == "Microsoft Internet Explorer"var imgheight_closevar imgleftwindow.screen.width》800 ? imgheight_close=120:imgheight_close=120window.screen.width》800 ? imgleft=8:imgleft=122function myload(){myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight_close;myleft.style.left=imgleft;leftmove();}function leftmove(){ myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight_close;myleft.style.left=imgleft;setTimeout("leftmove();",50)}function MM_reloadPage(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_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();}MM_reloadPage(true)function close_float_left(){myleft.style.visibility=’hidden’;}document.write("《div id=myleft style=’position: absolute;width:80;top:300;left:5;visibility: visible;z-index: 1’》"+"《style》"+"A.closefloat:link,A.refloat:visited {text-decoration:none;color:#000000;font-size:12px}"+"A.closefloat:active,A.refloat:hover {text-decoration:underline;color:#0000FF;font-size:12px}"+"《/style》"+"《table border=0 cellpadding=0 cellspacing=0》《tr》《td》");if(document.ns){if(ad_float_left_type!="swf")document.write("《a href=’" + ad_float_left_url + "’ target = ’_blank’》《img src=’" + ad_float_left_src + "’ WIDTH=88 height=31 border=0》《/a》");elsedocument.write("《EMBED src=’" + ad_float_left_src + "’ quality=high WIDTH=80 HEIGHT=80 TYPE=’application/x-shockwave-flash’ id=changhongout 》《/EMBED》");document.write("《/td》《/tr》《tr》《td width=80 height=20 align=right》《a href=’javascript:close_float_left();void(0);’ class=closefloat》《b》《font color=#ff0000》关闭《/font》《/b》《/a》《/td》《/tr》"+"《/table》"+"《/div》");myload()} 把上面的代码另存为一个*.JS文件,然后在想实现此效果的页面用CODE:《script src="*.js"》《/SCRIPT》调用即可,*代表你另存的文件名!注意修改广告图片地址和连接地址!相应的参数可以根据页面自行调整。
网站Flash对联广告源代码
把下面这段代码保存为 adver-left.js var imgheight var imgleft document.ns = navigator.appName == "Netscape" window.screen.width》800 ? imgheight=100:imgheight=100 window.screen.width》800 ? imgleft=15:imgleft=122 function myload() { if (navigator.appName == "Netscape") {document.myleft.pageY=pageYOffset+window.innerHeight-imgheight; document.myleft.pageX=imgleft; leftmove(); } else { myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight; myleft.style.left=imgleft; leftmove(); } } function leftmove() { if(document.ns) { document.myleft.top=pageYOffset+window.innerHeight-imgheight document.myleft.left=imgleft; setTimeout("leftmove();",80) } else { myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight; myleft.style.left=imgleft; setTimeout("leftmove();",80) } } if (navigator.appName == "Netscape") { document.write("《layer id=myleft top=300 width=80 height=88》《EMBED src=’swf/00001.swf’ quality=high WIDTH=80 HEIGHT=80 TYPE=’application/x-shockwave-flash’ id=changhongout wmode=’transparent’》《/EMBED》《/layer》"); myload()} else { document.write("《div id=myleft style=’position: absolute;width:80;top:150;left:5;visibility: visible;z-index: 1’》《EMBED src=’swf/00001.swf’ quality=high WIDTH=80 HEIGHT=80 TYPE=’application/x-shockwave-flash’ id=changhongout wmode=’transparent’》《/EMBED》《/div》"); myload() } 把下面这段代码保存为 adver-right.js var imgheight document.ns = navigator.appName == "Netscape" window.screen.width》800 ? imgheight=100:imgheight=100 function myload() { if (navigator.appName == "Netscape") {document.dangdang.pageY=pageYOffset+window.innerHeight-imgheight; document.dangdang.pageX=+window.innerWidth-120; mymove(); } else { dangdang.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight; dangdang.style.left=document.body.offsetWidth-120; mymove(); } } function mymove() { if(document.ns) { document.dangdang.top=pageYOffset+window.innerHeight-imgheight; document.dangdang.left=pageXOffset+window.innerWidth-120; setTimeout("mymove();",50) } else { dangdang.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight; dangdang.style.left=document.body.scrollLeft+document.body.offsetWidth-120; setTimeout("mymove();",50) } } function MM_reloadPage(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_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true) if (navigator.appName == "Netscape") {document.write("《layer id=dangdang top=300 width=80 height=88》《EMBED src=’swf/00001.swf’ quality=high WIDTH=80 HEIGHT=80 TYPE=’application/x-shockwave-flash’》《/EMBED》《/layer》"); myload()} else { document.write("《div id=dangdang style=’position: absolute;width:80;top:0;left:578;visibility: visible;z-index: 1’》《EMBED src=’swf/00001.swf’ quality=high WIDTH=80 HEIGHT=80 TYPE=’application/x-shockwave-flash’》《/EMBED》《/div》"); myload() } 网页中是这样调用,注意修改 js 文件的路径 《SCRIPT src="js/adver-left.js"》《/SCRIPT》 《SCRIPT src="js/adver-right.js"》《/SCRIPT》 上面两段代码中的 src=’swf/00001.swf’ ,改为自己广告的flash的路径
网站主页怎么添加对联广告代码啊添加到哪里是新建个html还是怎么办啊
对联广告其实就是一个JS,你去模版王或者懒人图库下载下载一个就可以了,很简单的。欢迎追问。
直接在页面两边固定两个div就OK了,css代码如下:.adv { position: fixed; top: 100px; width: 200px; height: 300px;}.leftAdv { left: 5px;}.rightAdv { right: 5px;}
浮动对联广告代码 兼容if,firefox
您好,很高兴为您解答: 1.此浮动对联广告在有没有《!DOCTYPE html 的网页里表现形式是不一样的: 《!DOCTYPE html 有的情况下是: document.documentElement. 《!DOCTYPE html 没有的情况下是: document.body. 2.如果要兼容if,firefox如果修改: followObj.style.left=followObj.offsetLeft+dx+ "px"; ////没有加上px 浮动窗口Firefox就不可以显示 followObj.style.top=followObj.offsetTop+dy+ "px"; ////没有加上px 浮动窗口Firefox就不可以显示 转载,仅供参考。 如果我的回答没能帮助您,请继续追问。
想要个带关闭的随动对联广告代码,可以自己更换代码广告的那种 js 或asp的都可以
JS代码实现对联式浮动广告演示!self.onError=null;currentX = currentY = 0;whichIt = null;lastScrollX = 0; lastScrollY = 0;NS = (document.layers) ? 1 : 0;IE = (document.all) ? 1: 0;function heartBeat() {if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }if(diffY != lastScrollY) {percent = .1 * (diffY - lastScrollY);if(percent 》 0) percent = Math.ceil(percent);else percent = Math.floor(percent);if(IE) document.all.floater.style.pixelTop += percent;if(NS) document.floater.top += percent; lastScrollY = lastScrollY + percent;}if(diffX != lastScrollX) {percent = .1 * (diffX - lastScrollX);if(percent 》 0) percent = Math.ceil(percent);else percent = Math.floor(percent);if(IE) document.all.floater.style.pixelLeft += percent;if(NS) document.floater.left += percent;lastScrollX = lastScrollX + percent;}}function checkFocus(x,y) { stalkerx = document.floater.pageX;stalkery = document.floater.pageY;stalkerwidth = document.floater.clip.width;stalkerheight = document.floater.clip.height;if( (x 》 stalkerx && x 《 (stalkerx+stalkerwidth)) && (y 》 stalkery && y 《 (stalkery+stalkerheight))) return true;else return false;}function grabIt(e) {if(IE) {whichIt = event.srcElement;while (whichIt.id.indexOf("floater") == -1) {whichIt = whichIt.parentElement;if (whichIt == null) { return true; }}whichIt.style.pixelLeft = whichIt.offsetLeft;whichIt.style.pixelTop = whichIt.offsetTop;currentX = (event.clientX + document.body.scrollLeft);currentY = (event.clientY + document.body.scrollTop); } else { window.captureEvents(Event.MOUSEMOVE);if(checkFocus (e.pageX,e.pageY)) { whichIt = document.floater;StalkerTouchedX = e.pageX-document.floater.pageX;StalkerTouchedY = e.pageY-document.floater.pageY;} }return true;}function moveIt(e) {if (whichIt == null) { return false; }if(IE) {newX = (event.clientX + document.body.scrollLeft);newY = (event.clientY + document.body.scrollTop);distanceX = (newX - currentX); distanceY = (newY - currentY);currentX = newX; currentY = newY;whichIt.style.pixelLeft += distanceX;whichIt.style.pixelTop += distanceY;if(whichIt.style.pixelTop 《 document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop;if(whichIt.style.pixelLeft 《 document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft;if(whichIt.style.pixelLeft 》 document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;if(whichIt.style.pixelTop 》 document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5;event.returnValue = false;} else { whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);if(whichIt.left 《 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset;if(whichIt.top 《 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset;if( (whichIt.left + whichIt.clip.width) 》= (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;if( (whichIt.top + whichIt.clip.height) 》= (window.innerHeight+self.pageYOffset-17)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;return false;}return false;}function dropIt() {whichIt = null;if(NS) window.releaseEvents (Event.MOUSEMOVE);return true;}《!-- DRAG Drop CODE --》if(NS) {window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);window.onmousedown = grabIt;window.onmousemove = moveIt;window.onmouseup = dropIt;}if(NS || IE) action = window.setInterval("heartBeat()",1);将以上内容保存到一个文件:code.js,将以下内容放到广告的页面,修改test.jpg,改成自己的图片或者FLASH文件《SCRIPT language="javascript" src="code.js"》《/SCRIPT》《div id="floater" style="left:11px;top: 98px;width:100%;position: absolute;visibility:visible;z-index:1"》《div id="dllayer3" style="left:0px; position: absolute; visibility:visible; z-index:2; width: 101px; height: 286px;"》《img src="test.jpg" width="80" height="100" border="0"》《/div》《div id=dllayer2 style=’right:0px; position: absolute; visibility:visible; z-index:2; left: 875px; top: 0px; width: 80px; height: 100px;’》《img src="test.jpg" width="80" height="100" border="0"》《/div》《/div》
怎么写带关闭的网页广告对联代码,是网页两侧的那种
function $(id) {
return document.getElementById(id);
}
function scrollBanner(timer, moveNumber) {
function move(o) {
var st = document.documentElement.scrollTop + o.t;
var sl = document.documentElement.scrollLeft + (o.c == 0 ? o.a : document.documentElement.clientWidth - o.a - o.offsetWidth);
var tc = st - o.offsetTop, lc = sl - o.offsetLeft;
with (o.style) {
top = o.offsetTop + (tc != 0 ? tc / Math.abs(tc) : 0) * Math.min(Math.abs(tc), moveNumber) + "px";
left = o.offsetLeft + (lc != 0 ? lc / Math.abs(lc) : 0) * Math.min(Math.abs(lc), moveNumber) + "px";
}
if (o.person) {
with (o.person.style) {
top = o.offsetTop + "px";
left = o.offsetLeft + o.offsetWidth - o.person.offsetWidth + "px";
}
}
}
var hidden = function() {
var o = this.parent;
window.clearInterval(o.interval);
o.parentNode.removeChild(o);
this.parentNode.removeChild(this);
}
this.add = function (to, t, a, c, lo) {
/*
to为object对象
t为距离顶端距离
当c = 0的时候,a为距离左边的距离
当c != 0的时候,a为距离右边的距离
lo为关闭按钮
*/
var div, exec = function () {
move(to);
};
to.person = lo;
to.t = t;
to.a = a;
to.c = c;
with (to.style) {
position = "absolute";
display = "block";
top = document.documentElement.scrollTop + t;
left = document.documentElement.scrollLeft + (c == 0 ? a : document.documentElement.clientWidth - a - to.offsetWidth);
}
if ("undefined" != typeof lo) {
with (lo.style) {
position = "absolute";
display = "block";
}
lo.onmousedown = hidden;
lo.parent = to;
}
exec();
to.interval = window.setInterval(exec, timer);
};
}
window.onload = function () {
var b = new scrollBanner(10,15);
b.add($("lwc"), 80, 10, 0, $("lwc_c"));
b.add($("rwc"), 80, 10, 1, $("rwc_c"));
b = null;
}
更多文章:
搞笑的测试题及答案?犯罪心理学测试题 测试学中测试幽默的心理测试题
2024年8月29日 20:50
地铁中,盾构过站是什么意思?地铁如果修延长线,盾构机到达已运营的车站后怎么出来或调头
2024年9月17日 17:50
as i moved on(Blue Foundation-As I Moved on中文歌词)
2024年9月10日 03:50