廣告代碼2
來源:易賢網(wǎng) 閱讀:783 次 日期:2014-09-09 15:28:20
溫馨提示:易賢網(wǎng)小編為您整理了“廣告代碼2”,方便廣大網(wǎng)友查閱!

與前面一個代碼不同的是,當鼠標移動到廣告圖片上是可以感應(yīng)顯示另外設(shè)置好的廣告大圖效果,下面就是實現(xiàn)效果所需代碼:

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);

ad_80[0]="<a href=http://www.dfeng.net target=_blank><img src=/skin/adv43/ad/ad_ad.gif border=0></a>";

ad_250[0]="<a href=http://www.dfeng.net target=_blank><img src=/skin/adv43/ad/ad_ad2.gif border=0></a>";

var imgheight;

var fubioleft;

window.screen.width>800 ? fubioleft=15:fubioleft=15

document.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() %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/")'>";

document.write(adhead1+ad_80[ad_id]+adhead2+ad_250[ad_id]+"</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);

ad_80[0]="<a href=http://www.dfeng.net target=_blank><img src=/skin/adv43/ad/ad_ad.jpg border=0></a>";

ad_250[0]="<a href=http://www.dfeng.net target=_blank><img src=/skin/adv43/ad/ad_ad.jpg border=0></a>";

var imgheight;

var fubioleft;

window.screen.width>800 ? fubioleft=15:fubioleft=15

document.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() %1

function 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[ad_id]+adhead2+ad_250[ad_id]+"</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文件,然后在想實現(xiàn)此效果的頁面用

<script type="text/javascript" language="javascript1.2" src="*.js"></SCRIPT>

調(diào)用即可,*代表你另存的文件名!注意修改廣告圖片地址和連接地址!

更多信息請查看IT技術(shù)專欄

更多信息請查看腳本欄目
易賢網(wǎng)手機網(wǎng)站地址:廣告代碼2
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇剩?/div>

2025國考·省考課程試聽報名

  • 報班類型
  • 姓名
  • 手機號
  • 驗證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 加入群交流 | 手機站點 | 投訴建議
工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
咨詢QQ:526150442(9:00—18:00)版權(quán)所有:易賢網(wǎng)