[图片 显示] 缩图循环显示(php,mysql,script)
发表于:2007-07-01来源:作者:点击数:
标签:
这几天被这问题折腾了一下,总算可以用了. 也同时给,辛苦工作的兄弟们一个提示吧: 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=# C
这几天被这问题折腾了一下,总算可以用了.
也同时给,辛苦工作的兄弟们一个提示吧:
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}
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];?>";
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;
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>
原文转自:http://www.ltesting.net