rengo 2006-1-1 06:03
仿Leoboard 跳出提醒註冊視窗 Dz通用
1。編輯範本header.htm
在</head> 和 <body> 間插入以下代碼︰
[code]<!--{if !$discuz_user}--><SCRIPT language=JavaScript1.2>
adTime=5;
chanceAd=1;
var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);
adCount=0;
function initAd(){
if(!ns && !ie && !w3) return;
if(ie) adDiv=eval('document.all.sponsorAdDiv.style');
else if(ns) adDiv=eval('document.layers["sponsorAdDiv"]');
else if(w3) adDiv=eval('document.getElementById("sponsorAdDiv").style');
randAd=Math.ceil(Math.random()*chanceAd);
if (ie||w3)
adDiv.visibility="visible";
else
adDiv.visibility ="show";
if(randAd==1) showAd();
}
function showAd(){
if(adCount<adTime*10){adCount+=1;
if (ie){documentWidth =document.body.offsetWidth/2+document.body.scrollLeft-20;
documentHeight =document.body.offsetHeight/2+document.body.scrollTop-20;}
else if (ns){documentWidth=window.innerWidth/2+window.pageXOffset-20;
documentHeight=window.innerHeight/2+window.pageYOffset-20;}
else if (w3){documentWidth=self.innerWidth/2+window.pageXOffset-20;
documentHeight=self.innerHeight/2+window.pageYOffset-20;}
adDiv.left=documentWidth-200;adDiv.top =documentHeight-160;
setTimeout("showAd()",100);}else closeAd();
}
function closeAd(){
if (ie||w3)
adDiv.display="none";
else
adDiv.visibility ="hide";
}
onload=initAd;
</SCRIPT>
<!--{/if}-->[/code]
2。修改index.htm範本
找到︰
[code]{template header}[/code]
在其下面加入︰
[code]<!--{if !$discuz_user}-->
<DIV id=sponsorAdDiv style="position: absolute;visibility: hidden;height: 1;width: 1;top: 50;left: 50">
<table width=520 height=320 bgcolor={BORDERCOLOR} style="border: 1 outset #FFFFFF"><tr><td>
<table width=490 height=290 bgcolor=FFFFFF align=center style="border: 1 inset #EEEEEE">
<tr><td align=center valign=middle>
<img src={IMGDIR}/logo.gif border=0><P>請先註冊以避免此視窗出現<br><br>
<b><a href=register.php title=按這裏進行註冊><u>註 冊</u></a>
<a href=logging.php?action=login title=從這裏可以進入社區><u>登 入</u></a></b><p>(此視窗將於 5 秒後自動關閉)</td></tr></table></td></tr></table></div><!--{/if}-->[/code]