首页调用新闻图片幻灯片轮换


把这个放到index.asp末尾:

程序代码:
sub revealTrans_news_pic()
dim id,pic,i,id0,pic0,temp2
i=0
id0=0
pic0=joekoe_cms.web_upload&"no_pic.gif"
sql="select top 8 id,topic,pic from news where hidden=1 and ispic=1 order by id desc"
set rs=joekoe_cms.exec(sql,1)
do while not rs.eof
id=rs("id")
pic=rs("pic")
pic=joekoe_cms.code_html(pic,1,0)
if instr(pic,"://")<1 then
pic=joekoe_cms.web_upload&pic
end if
if i=0 then
id0=rs("id")
pic0=rs("pic")
end if
temp2= temp2&vbcrlf&" bannerAD["&i&"]="""&pic&""";"
temp2= temp2&vbcrlf&" bannerADlink["&i&"]=""news_view.asp?id="&id&""";"&vbcrlf
i=i+1
rs.movenext
loop
rs.close
pic0=pic_fk(pic0&"' name=bannerADrotator style='FILTER: revealTrans(duration=2,transition=20)",2,"javascript:jump2url();")
if instr(pic0,"target=_blank")>0 then pic0=replace(pic0,"target=_blank","")
response.write pic0
%>
<script language=Javascript>
<!-- // 新闻图片过渡效果

var bannerAD=new Array();
var bannerADlink=new Array();
var adNum=0;
<%
if id0=0 then
%>
bannerAD[0]="<%=pic0%>";
bannerADlink[0]="#";

bannerAD[1]="<%=pic0%>";
bannerADlink[1]="#";
<%
else
response.write temp2
end if
%>
var preloadedimages=new Array();
for (i=1;i<bannerAD.length;i++){
preloadedimages=new Image();
preloadedimages.src=bannerAD;
}

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(adNum<bannerAD.length-1)adNum++
else adNum=0;
setTransition();
document.images.bannerADrotator.src=bannerAD[adNum];
playTransition();
theTimer=setTimeout("nextAd()", 8000);
}

function jump2url(){
jumpUrl=bannerADlink[adNum];
jumpTarget='';
if (jumpUrl != ''){
if (jumpTarget != '')window.open(jumpUrl,jumpTarget);
else location.href=jumpUrl;
}
}
function displayStatusMsg() {
status=bannerADlink[adNum];
document.returnvalue = true;
}
nextAd()
//-->

</script>
<%
end sub

调用:<%call revealTrans_news_pic()%>
http://www.joekoe.com/forum_view.asp?forum_id=7&view_id=53639

文章来自: Original
引用通告: 查看所有引用 | 我要引用此文章
Tags:
相关日志:
评论: 6 | 引用: 0 | 查看次数: 1124
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 20 字 | UBB代码 关闭 | [img]标签 关闭