php中动态显示广告代码

<? php
$i = 0 ;
$s = "" ;
$bannerAD [ 0 ] = ' http://photos.album.mop.com/c03/66/68/6c/686662e65c/tn_1159655758191.jpg ' ;
$bannerAD [ 1 ] = ' http://photos.album.mop.com/c03/66/68/6c/686662e65c/md_1159652187248.jpg ' ;
$bannerAD [ 2 ] = ' http://photos.album.mop.com/c03/66/68/6c/686662e65c/md_1159652186914.jpg ' ;
$bannerAD [ 3 ] = ' http://photos.album.mop.com/c03/66/68/6c/686662e65c/md_1159652186546.jpg ' ;
$bannerAD [ 4 ] = ' http://photos.album.mop.com/c03/66/68/6c/686662e65c/md_1159652186184.jpg ' ;
$bannerAD [ 5 ] = ' http://photos.album.mop.com/c03/66/68/6c/686662e65c/tn_1159655758900.jpg ' ;
while ( list ( $key , $value ) = each ( $bannerAD )){  
                
$keyp = ( $key - 1 ) < 0 ? 0 : ( $key - 1 );
                
$s   .=   " bannerAD[ " . $i . " ]=' " . DIR . " / " . $bannerAD [ $keyp ] . " '; " ;
                
$i ++ ;
}          
?>
< script language = " JavaScript "  type = " text/javascript " >
var  bannerAD = new  Array();
var  adNum = 0 ;
<? php echo $s;  ?>
var  preloadedimages = new  Array();
for  (i = 1 ;i < bannerAD.length;i ++ ) {
 preloadedimages[i]
=new Image();
 preloadedimages[i].src
=bannerAD[i];
}

function  setTransition() {
 
if (document.all){
  bannerADrotator.filters.revealTrans.Transition
=Math.floor(Math.random()*23);
  bannerADrotator.filters.revealTrans.apply();
 }

}

function  playTransition() {
 
if (document.all)
 bannerADrotator.filters.revealTrans.play()
}

function  nextAd() {
 
if(bannerAD.length==0)return;
 
if(adNum<bannerAD.length-1)adNum++ ;
 
else adNum=0;
 setTransition();
 document.images.bannerADrotator.src
=bannerAD[adNum];
 playTransition();
 theTimer
=setTimeout('nextAd()'3000);
}

function  showslidepic() {
var html="";
html 
= '<table width="200" border="0" cellpadding="0" cellspacing="0">';
html 
+=  '<tr>';
html 
+=  '<td align="center" valign="middle" id="photos">';
html 
+=  '<img name="bannerADrotator"  style="FILTER: revealTrans(duration=2,transition=20)"';
html 
+=  'src="'+bannerAD[0]+'" /></td></tr>';
html 
+=  '<tr>';
html 
+=  '<td align=center>';
html 
+=  '<hr><img src="http://album.mop.com/images/ji_button1.jpg" οnclick="nextAd()" border="0" style="cursor:hand">';
html 
+=  '&nbsp;&nbsp;<img src="http://album.mop.com/images/ji_button2.jpg"  οnclick="clearTimeout(theTimer)" border="0" style="cursor:hand">';
html 
+=  '</td></td>';
html 
+=  '</tr></table>';
document.write(html);
}

</ script >
< script > showslidepic();nextAd() </ script >
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值