这几天被这问题折腾了一下,总算可以用了. 也同时给,辛苦工作的兄弟们一个提示吧: www.phperz.com
1. .css 增加 .shadow{filter: DropShadow(Color=#385370, OffX=1, OffY=1, Positive=1);font-size:12px; color: #FFFFFF; text-decoration: none} .shadow1{filter: DropShadow(Color=#CCCCCC, OffX=1, OffY=1, Positive=1);text-decoration: none} phperz~com
2.php对script数组附值 //..............读数据库相关内容 $num = 0; if (file_exists( $photoName)){// $photoName为图片路径,在我前一文章里,有自动生成缩图的方法 //添加script数组 $num = $num 1; $imgUrlCanSwap[ $num] = "http://www.xbcb.com/". $photoName; //图片网址 $imgLinkCanSwap[ $num] = "http://www.xbcb.com/includes/show_products.php?id=". $list_values['id']; //连接的网址 $imgTextCanSwap[ $num]= $list_values['name']; //标题 } 3.生成循环显示图片 <script language=JavaScript> <!-- var imgUrlCanSwap=new Array(); var imgLinkCanSwap=new Array(); var imgTextCanSwap=new Array(); var adNumCanSwap=0; <?php for ( $i=1; $i<= $num; $i ) {// $num为2.php对script数组附值的变量 ?> imgLinkCanSwap[<?php echo $i;?>] ="<? echo $imgLinkCanSwap[$i];?>"; phperz.com imgUrlCanSwap[<?php echo $i;?>] ="<? echo $imgUrlCanSwap[$i];?>"; imgTextCanSwap[<?php echo $i;?>] ="<? echo $imgTextCanSwap[$i];?>"; <? } ?> var imgPreCanSwap=new Array(); var jCanSwap=0; for (iCanSwap=0;iCanSwap<=imgLinkCanSwap.length - 2;iCanSwap ) { if(imgLinkCanSwap[iCanSwap]!="") {jCanSwap ;} else {break;} } function playTranCanSwap(){ if (document.all) imgInitCanSwap.filters.revealTrans.play(); } var keyCanSwap=0; function nextAdCanSwap(){ if(adNumCanSwap<jCanSwap)adNumCanSwap ; else adNumCanSwap=1; www~phperz~com
if( keyCanSwap==0 ){keyCanSwap=1;} else if (document.all){ imgInitCanSwap.filters.revealTrans.Transition=6; imgInitCanSwap.filters.revealTrans.apply(); playTranCanSwap(); } document.images.imgInitCanSwap.src=imgUrlCanSwap[adNumCanSwap]; document.images.imgInitCanSwap.alt=imgTextCanSwap[adNumCanSwap]; jumpUrlCanSwap=imgLinkCanSwap[adNumCanSwap]; theTimerCanSwap=setTimeout("nextAdCanSwap()", 5000); if(document.all.textInitCanSwap) { document.all.textInitCanSwap.href = imgLinkCanSwap[adNumCanSwap]; document.all.textInitCanSwap.innerText = imgTextCanSwap[adNumCanSwap]; } } function goUrlInitCanSwap(){ jumpTarget='_blank'; if (jumpUrlCanSwap != ''){ if (jumpTarget != '') window.open(jumpUrlCanSwap,jumpTarget); else location.href=jumpUrlCanSwap; } } //--></script> <A onclick="javascript:goUrlInitCanSwap();return false;" href="#"><IMG style="FILTER: revealTrans(duration=2,transition=6)" src="javascript:nextAdCanSwap()" border=0 name=imgInitCanSwap></A> www~phperz~com php程序员站
|