檔案
index.asp 首頁--用以呼叫banner.inc
banner.inc 輪撥廣告語法
備註:檔名需改為asp 並且上傳至網站才能被執行
banner.inc的內容
<SCRIPT LANGUAGE="JavaScript"> <!-- Begin var how_many_ads = 4; //你要有幾個廣告輪播 var now = new Date() var sec = now.getSeconds() var ad = sec % how_many_ads; ad +=1; if (ad==1) { url="http://por.tw"; //第一個廣告的目的網站網址(下同) alt="阿威的網站"; banner="廣告圖.gif"; //該廣告顯示的圖片位址 width="468"; //廣告圖片的長度 height="60"; //廣告圖片的寬度 } if (ad==2) { url="http://www.第二個網站網址.com"; alt="第二個廣告站"; banner="廣告圖.gif"; width="468"; height="60"; } if (ad==3) { url="http://www.第三個網站網址.com"; alt="第三個廣告站"; banner="廣告圖.jpg"; width="468"; height="60"; } if (ad==4) { url="http://www.第四個網站網址.com"; alt="第四個廣告站"; banner="廣告圖.swf"; width="468"; height="60"; } document.write('<center>'); document.write('<a href="' + url + '" target="_blank">'); document.write('<img src="' + banner + '" width=') document.write(width + ' height=' + height + ' '); document.write('alt="' + alt + '" border=0><br>'); document.write('<small>' + txt + '</small></a>'); document.write('</center>'); // End --> </SCRIPT>
|
第二種寫法_可以插入google廣告
<CENTER> <% dim showfile dim selectend selectend=second(now()) sx=selectend MOD 7
IF sx=1 THEN ELSEIF sx=2 THEN showfile="<a href=連結網址 target=_blank><img src=連結圖檔.gif border=0></a>" ELSEIF sx=3 THEN showfile="<a href=連結網址 target=_blank><img src=連結圖檔.gif border=0></a>" ELSEIF sx=4 THEN showfile="<a href=連結網址 target=_blank><img src=連結圖檔.gif border=0></a>" ELSEIF sx=5 THEN showfile="<a href=連結網址 target=_blank><img src=連結圖檔.gif border=0></a>" ELSEIF sx=6 THEN showfile="<a href=連結網址 target=_blank><img src=連結圖檔.gif border=0></a>" ELSE showfile="<a href=連結網址 target=_blank><img src=連結圖檔.gif border=0></a>" END IF if sx=1 THEN %> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- google廣告插入.468*60 --> <ins class="adsbygoogle" style="display:inline-block;width:468px;height:60px" data-refresh="false" data-ad-region= "test" data-ad-client="ca-pub-4328390477560338" data-ad-host="ca-pub-7449992691305813" data-ad-slot="6914695488" data-ad-host-channel="0911570353"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <% else response.write showfile end if %> </CENTER>
|
你的index.asp 內容
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=big5" /> <title>無標題文件</title> </head>
<body> <% server.execute "banner.inc" %> </body> </html>
|
呼叫banner.inc 並且在本機端執行