SoFunction
Updated on 2025-04-13

JS code judgment highlight page 4/5

Advertising JS code effects collection 1. [Ordinary effect] Many website advertisements are in full swing now. Now I will introduce the common code usage methods for couplet floating advertising effects. The introduced effect is displayed normally at 1024*768 resolution, and can be automatically hidden at 800*600 resolution to avoid covering the page and affecting the visitor's browsing content. The following is the code required to achieve the effect: var delta=0.015 var collection; function floaters() { = []; = function(id,x,y,content) { ('<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 = {}; = (id); = x; = y; [] = newItem; } = function() { collection = setInterval('play()',10); } } function play() { if(<=800) { for(var i=0;i<;i++) { = 'none'; } return; } for(var i=0;i<;i++) { var followObj = ; var followObj_x = (typeof()=='string'?eval():); var followObj_y = (typeof()=='string'?eval():); if(!=(+followObj_x)) { var dx=(+followObj_x)*delta; dx=(dx>0?1:-1)*((dx)); =+dx; } if(!=(+followObj_y)) { var dy=(+followObj_y)*delta; dy=(dy>0?1:-1)*((dy)); =+dy; } = ''; } } var theFloaters = new floats(); ('followDiv1','-100',0,'</a><br><a href=Advertising link address target=_blank><img src=Advertising image address width=100 height=400 border=0></a>' target=_blank); ('followDiv2',0,0,'<br><a href=Advertising link address target=_blank><img src=Advertising image address width=100 height=400 border=0></a>' target=_blank); (); Save the above code as a JS file, and then use it to call the page that wants to achieve this effect! Pay attention to modifying the ad image address and connection address! Advertising JS code effects collection ~~~~~~~~~ 2.[Mouse Sensing] Unlike the previous code, when the mouse moves to the advertising image, it can sense the display of the additionally set advertising image effect. The following is the code required to achieve the effect: function bigshow(){ .div_250. = 'visible'; .div_80. = 'hidden'; } function bighide(){ .div_80. = 'visible'; .div_250. = 'hidden'; } var ad_80= new Array(1); var ad_250= new Array(1); ad_80[0]="<a href= target=_blank><img src=/skin/adv43/ad/ad_ad.gif border=0></a>"; ad_250[0]="<a href= target=_blank><img src=/skin/adv43/ad/ad_ad2.gif border=0></a>"; var imgheight; var fubioleft; >800 ? fubioleft=15:fubioleft=15 ('<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() %1 var 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\")'>"; (adhead1+ad_80[ad_id]+adhead2+ad_250[ad_id]+"</div>"); ("</div>"); =null; currentX = currentY = 0; whichIt = null; lastScrollX = 0; lastScrollY = 0; NS = () ? 1 : 0; IE = () ? 1: 0; function heartBeat() { if(IE) { diffY = ; diffX = ; } if(NS) { diffY = ; diffX = ; } if(diffY != lastScrollY) { percent = .5 * (diffY - lastScrollY); if(percent > 0) percent = (percent); else percent = (percent); if(IE) .floater_left. += percent; if(NS) document.floater_left.top += percent; lastScrollY = lastScrollY + percent; } if(diffX != lastScrollX) { percent = .5 * (diffX - lastScrollX); if(percent > 0) percent = (percent); else percent = (percent); if(IE) .floater_left. += percent; if(NS) document.floater_left.left += percent; lastScrollX = lastScrollX + percent; } } if(NS || IE) action = ("heartBeat()",1);var ad_80= new Array(1); var ad_250= new Array(1); ad_80[0]="<a href= target=_blank><img src=/skin/adv43/ad/ad_ad.jpg border=0></a>"; ad_250[0]="<a href= target=_blank><img src=/skin/adv43/ad/ad_ad.jpg border=0></a>"; var imgheight; var fubioleft; >800 ? fubioleft=15:fubioleft=15 ('<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() %1 function myload() { if ( == "Netscape") { document.div_right_80.pageX=+-130; document.div_right_250.pageX=+-300; mymove(); } else { div_right_80.=-130; div_right_250.=-300; mymove(); } } function mymove() { if() { document.div_right_80.left=pageXOffset+-130; document.div_right_250.left=pageXOffset+-300; setTimeout("mymove();",20) } else { div_right_80.=+-145; div_right_250.=+-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>"; (adhead1+ad_80[ad_id]+adhead2+ad_250[ad_id]+"</div></div>"); myload() ("</div>"); =null; currentX_right = currentY_right = 0; whichIt_right = null; lastScrollX_right = 0; lastScrollY_right = 0; NS = () ? 1 : 0; IE = () ? 1: 0; function heartBeat_right() { if(IE) { diffY_right = ; diffX_right = ; } if(NS) { diffY_right = ; diffX_right = ; } if(diffY_right != lastScrollY_right) { percent_right = .5 * (diffY_right - lastScrollY_right); if(percent_right > 0) percent_right = (percent_right); else percent_right = (percent_right); if(IE) .floater_right. += 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 = (percent_right); else percent_right = (percent_right); if(IE) .floater_right. += percent_right; if(NS) document.floater_right.left += percent_right; lastScrollX_right = lastScrollX_right + percent_right; } } if(NS || IE) action = ("heartBeat_right()",1); function bigshow_right(){ .div_right_250. = 'visible'; .div_right_80. = 'hidden'; } function bighide_right(){ .div_right_80. = 'visible'; .div_right_250. = 'hidden'; }(''); (''); (''); 3.[Allow close] Unlike the previous two codes, an image button is added below the advertising image, allowing visitors to click to close the advertising image. The following text box is the code required to achieve the effect: var delta=0.015; var collection; var closeB=false; function floaters() { = []; = function(id,x,y,content) { ('<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 = {}; = (id); = x; = y; [] = newItem; } = function() { collection = setInterval('play()',30); } } function play() { if(<=800 || closeB) { for(var i=0;i<;i++) { = 'none'; } return; } for(var i=0;i<;i++) { var followObj = ; var followObj_x = (typeof()=='string'?eval():); var followObj_y = (typeof()=='string'?eval():); if(!=(+followObj_x)) { var dx=(+followObj_x)*delta; dx=(dx>0?1:-1)*((dx)); =+dx; } if(!=(+followObj_y)) { var dx=(+followObj_x)*delta; dx=(dx>0?1:-1)*((dx)); =+dx; } if(!=(+followObj_y)) { var dy=(+followObj_y)*delta; dy=(dy>0?1:-1)*((dy)); =+dy; } = ''; } } function closeBanner() { closeB=true; return; } var theFloaters = new floats(); // ('followDiv1','-100',0,'<a href= target=_blank><img src=ad/doublead/ width=100 height=554 border=0></a><br><br><img src=ad/doublead/ >'); ('followDiv2',0,0,'<a href= target=_blank><img src=ad/doublead/ad_ad.gif width=100 height=400 border=0 >/a><br><br><img src=ad/doublead/ >'); (); Save the above code as two JS files, and then call it with <script type="text/javascript" language="javascript1.2" src="*.js"></SCRIPT> on the page that wants to achieve this effect, * represents the file name you saved! Pay attention to modifying the ad image address and connection address!
Previous page12345Next pageRead the full text