http://www.asrich.com/userlist/admin/data/userpic/20061003188873.swf
 
 
 
 
当前位置:HOME > > 建站技巧
多张图片自动切换的代码 要求在原位自动切

发布时间 2006-08-21

多张图片自动切换的代码 要求在原位自动切换
<!--begin:图片轮换开始-->
<script language=JavaScript>
var imgUrl=new Array();
var imgLink=new Array();
var imgTz=new Array();
var buttonShow=1;
var buttonPos=1;
var buttonX;
var buttonY;
var bakularCode=""
var adNum=0;
var dakularCode="";
imgUrl[1]="http://www.icxo.com/images/focus/shandong.jpg";
imgLink[1]="http://finance.icxo.com/htmlnews/2005/09/07/661868.htm";
imgTz[1]="半年收本QQ抢占沪黑市场";
imgUrl[2]="http://www.icxo.com/images/focus/hai.jpg";
imgLink[2]="http://finance.icxo.com/htmlnews/2005/09/02/659032.htm";
imgTz[2]="傅成玉反思中海油收购案";
imgUrl[3]="http://www.icxo.com/images/focus/shiyou.jpg";
imgLink[3]="http://finance.icxo.com/htmlnews/2005/09/07/662140.htm";
imgTz[3]="煤变油成新一轮资源浪费?";
imgUrl[4]="http://www.icxo.com/images/focus/shandong.jpg";
imgLink[4]="http://finance.icxo.com/htmlnews/2005/09/05/660108.htm";
imgTz[4]="山东高耗能GDP跃进难再现";
var imgPre=new Array();
for (i=1;i<8;i++)
{
 imgPre[i]=new Image();
    imgPre[i].src=imgUrl[i];
 }
function setTransition()
{
 if (document.all)
 {
  imgUrlrotator.filters.revealTrans.Transition=23;//Math.floor(Math.random()*23)
            imgUrlrotator.filters.revealTrans.apply();
 }
}
function playTransition()
{
 if (document.all)
 imgUrlrotator.filters.revealTrans.play()
 }
 function nextAd(toNum)
 {
 if(adNum<imgUrl.length-1)
 adNum++ ;
 else
 adNum=1;
   if(toNum!=null) adNum=toNum;
   setTransition();
 document.images.imgUrlrotator.src=imgUrl[adNum];
 document.getElementById('linktext').innerHTML=imgTz[adNum];
  document.images.imgUrlrotator.alt='今日头条:'+imgTz[adNum];
 document.getElementById('linktext').innerHTML="<a href="+imgLink[adNum]+" target=_blank class=px14-lh20>"+imgTz[adNum]+"</a>";
 playTransition();
 checkButton();
 if(toNum!=null)
  {toNum=null;theTimer=setTimeout("nextAd()", 7000);}
 else
 {theTimer=setTimeout("nextAd()", 7000);}
 }
function jump2url()
{
 jumpUrl=imgLink[adNum];jumpTarget='_blank';
 if (jumpUrl != '')
 {  if (jumpTarget != '')
            window.open(jumpUrl,jumpTarget);
  else location.href=jumpUrl;
   }
 }
function displayStatusMsg()
{
 status=imgLink[adNum];
    document.returnValue = true;
 }
function checkButton()

}
function dakularButtons()
{
 if(buttonShow==1)
 {
  switch(buttonPos)
  {
   case 1:
   case 2:
   case 3:
   case 4:
   default:
  }
  for(i=1;i<=imgUrl.length-1;i++)
  {
   dakularCode=dakularCode+"<div id='bt"+i+"' style='display:inline; height=14px; width:20px; border:1px solid #000000; background-color:#f7f7f7; color:#000000; font-size:12px; line-height:14px; filter:Alpha(Opacity=50, FinishOpacity=50,Style=2);' align='center' onMouseOver=this.style.backgroundColor='#FFFFFF';this.style.color='#000000';this.style.cursor='hand' onMouseOut=checkButton(); onClick='clearTimeout(theTimer);nextAd("+i+");'>"+i+"</div>";
  }
  dakularCode="<div style='display:inline; position:relative;left:"+buttonX+"px; top:"+buttonY+"px; z-index:1;'>"+dakularCode+"</div>";
  document.write(dakularCode);
 }
}
</script>
<table border="0" cellpadding="0" cellspacing="0" id=newsTable style="position:relative; top:-10px;right:0px; font-size:12px;">
<script language="javascript">dakularButtons();</script><tr><td><a onMouseOver="displayStatusMsg();return document.returnValue;" onMouseOut="status='';" href="javascript:jump2url()"><img style="FILTER: revealTrans(duration=1,transition=18); border:1px solid #000000" src="javascript:nextAd()" width=160 height=150 border=0 name=imgUrlrotator alt="今日头条"></a></td></tr>
<tr><td bgcolor="#f0f0f0" align="center" style="border-bottom:1px solid #000000; border-left:1px solid #000000;border-right:1px solid #000000;" height="20"><label id="linktext"></label></td></tr>
</table>
<!--begin:图片轮换结束-->


红色部分为图片地址

绿色部分为图片链接到的地址

记得改下

[ 点击数:] [打印本网页] [关闭本窗口]
 

相关内容
查无记录
 
 

建站软件|网站建设|智能建站|虚拟主机|企业邮局|域名注册|网站推广|网站地图|
Copyright© 2006-2012 asrich.com  黔ICP备06002115号 网站管理