js 文件 function ImgMovie(){ this.Img=new Array(); this.Title=new Array(); this.Summary=new Array(); this.ImgPrv=new Array(); this.Link=new Array(); this.LinkType=new Array(); this.movCount=0; this.curImg=0; this.Target="_self"; this.TargetExt=""; this.ImgBox=null; this.TitleBox=null; this.SummaryBox=null; this.Style=0; //0透明过渡,1随机切换 this.AddMov=addMov; this.OpenUrl=openUrl; this.Play=nextMov; this.PlayStyle=playStyle; this.SetStyle=setStyle; this.ExecEvent=execEvent; } function execEvent(){ if(this.Link[this.curImg]!=""){ eval(this.Link[this.curImg]); } } function addMov(imgurl,tit,msg,linkurl,linkType){ this.Img[this.movCount]=""; this.Title[this.movCount]=""; this.Summary[this.movCount]=""; this.Link[this.movCount]=""; this.LinkType[this.movCount]="URL"; if(imgurl){ this.Img[this.movCount]=imgurl; this.ImgPrv[this.movCount]=new Image(); this.ImgPrv[this.movCount].src=imgurl; } if(tit)this.Title[this.movCount]=tit; if(msg)this.Summary[this.movCount]=msg; if(linkurl)this.Link[this.movCount]=linkurl; if(linkType)this.LinkType[this.movCount]=linkType; this.movCount++; } function setStyle(){ if (this.ImgBox!=null){ switch (this.Style){ case 0: eval(this.ImgBox+".filters.blendTrans.apply()"); break; case 1: eval(this.ImgBox+".filters.revealTrans.Transition=Math.floor(Math.random()*20)"); eval(this.ImgBox+".filters.revealTrans.apply()"); break; default: eval(this.ImgBox+".filters.blendTrans.apply()"); break; } } } function playStyle(){ if (this.ImgBox!=null){ switch (this.Style){ case 0: eval(this.ImgBox+".filters.blendTrans.play()"); break; case 1: eval(this.ImgBox+".filters.revealTrans.play()"); break; default: eval(this.ImgBox+".filters.blendTrans.play()"); break; } } } function nextMov(){ if(this.curImg<this.movCount-1)this.curImg++ ; else this.curImg=0; this.SetStyle(); if(this.ImgBox!=null)document.images[this.ImgBox].src=this.Img[this.curImg]; if(this.TitleBox!=null)eval(this.TitleBox+".innerText=this.Title["+this.curImg+"]"); if (this.SummaryBox!=null)eval(this.SummaryBox+".innerText=this.Summary["+this.curImg+"]"); this.PlayStyle(); } function openUrl(){ var jumpUrl=this.Link[this.curImg]; if(this.Target=='')this.Target='_self'; if (jumpUrl=='') return false; if (this.LinkType[this.curImg]=="EVENT"){ this.ExecEvent(); }else{ if(this.TargetExt!=''){ window.open(jumpUrl,this.Target,this.TargetExt); }else{ window.open(jumpUrl,this.Target); } } } function PlayImgMov(mov,timeout){ eval(mov+".Play()"); eval("Timer_"+mov+"=window.setTimeout(\"PlayImgMov('"+mov+"','"+timeout+"')\","+timeout+")"); } 调用节点:
{$}{$$}<SCRIPT> ImgNews.AddMov('/article/{$=split("{$content_images_list}", "|")(0)}','{$topic}','','{$=curl("{$baseurl}", iurl('detail', {$id}, {$urltype}, 'folder={$createfolder};filetype={$createfiletype};time={$time}'))}'); </SCRIPT> {$$}{$}
调用代码:
<table width="224" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="224" valign="top" background=""> <script src="{$global.images}js/ImgMovie.js"></script><!--修改好了JS文件路径 --> <script> var ImgNews=new ImgMovie; ImgNews.Target="_blank"; </script> {$=itransfer('top', 'imgtext', 'topx=5;tnum=40;genre=article;class=5;osql= and jtb_acontent_images_list <> """"')}<!--修改好了CLASS类,这里的sql语句不知有没有出错 -->
<table width="224" border="0" cellspacing="0" cellpadding="0" height="179"> <tr> <td height="150" align="center"> <table border="0" cellpadding="0" cellspacing="7"> <tr> <td width="175" height="120" align="center" valign="middle"><a href="javascript:ImgNews.OpenUrl();"><img name="newsImgBox" id="newsImgBox" src="" width="175" height="120" border="0"style="FILTER: revealTrans(duration=2,transition=20);"></a></td> </tr> </table></td> </tr> <tr> <td height="20" align="center"> <a href="javascript:ImgNews.OpenUrl();" class="a01"><span id="newsTitleBox">标题</span></a> </td> </tr> <tr> <td height="9" align="center"></td> </tr> </table>
<script> ImgNews.ImgBox="newsImgBox"; ImgNews.TitleBox="newsTitleBox"; ImgNews.Style=1; PlayImgMov("ImgNews",5000); </script> </td> </tr> </table>
|