<td width="560">
<%
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from advertisement",conn,1,1
tupian1=trim(rs("pic1"))
tupian1url=trim(rs("pic1_lnk"))
piaos1=trim(rs("tit1"))
tupian2=trim(rs("pic2"))
tupian2url=trim(rs("pic2_lnk"))
piaos2=trim(rs("tit2"))
tupian3=trim(rs("pic3"))
tupian3url=trim(rs("pic3_lnk"))
piaos3=trim(rs("tit3"))
tupian4=trim(rs("pic4"))
tupian4url=trim(rs("pic4_lnk"))
piaos4=trim(rs("tit4"))
rs.Close
set rs=nothing
%>
<script language=JavaScript>
var imgUrl=new Array();
var imgLink=new Array();
var adNum=0;
imgLink[2]="<%=tupian2url%>";
imgLink[1]="<%=tupian1url%>";
imgUrl[2]="<%=tupian2%>";
imgUrl[1]="<%=tupian1%>";
var imgPre=new Array();
var j=0;
for (i=0;i<=1;i++) {
if(imgLink[i]!="") {j++;}
else {break;}
}
function playTran(){
if (document.all)
imgInit.filters.revealTrans.play();
}
var key=0;
function nextAd(){
if(adNum<j)adNum++ ;
else adNum=1;
if( key==0 ){key=1;}
else if (document.all){
imgInit.filters.revealTrans.Transition=25;
imgInit.filters.revealTrans.apply();
playTran();
}
document.images.imgInit.src=imgUrl[adNum];
jumpUrl=imgLink[adNum];
theTimer=setTimeout("nextAd()", 5200);
}
function goUrl(){
jumpTarget='_blank';
if (jumpUrl != ''){
if (jumpTarget != '') window.open(jumpUrl,jumpTarget);
else location.href=jumpUrl;
}
}
</script>
<a href="javascript:goUrl()"><img style="FILTER: revealTrans(duration=2,transition=6)" src="javascript:nextAd()" width=555 border=0 name=imgInit height="224"></td>
一般都是浏览器兼容性问题,把代码精心规范了