56、链接使图片变换

56、链接使图片变换

脚本说明:

把如下代码加入<body>区域中

<SCRIPT language=JavaScript>

function imgchg(num,status,thisimg){

       myimg=new Image()

       myimg.src="http://image2.sina.com.cn/ty/nike//nid0"+num+"_"+status+".gif"

       eval(thisimg+".src='"+myimg.src+"'")

}

 

function newsPicItem(pic,text,link){

       this.pic=pic;

       this.text=text;

       this.link=link;

}

 

var npnum=1;

function newsPicChg(thisimg){

       myimg=new Image()

       myimg.src=newPic[npnum].pic

       eval(thisimg+".src='"+myimg.src+"'")

       textDiv=document.getElementById('newstext')

       textDiv.innerHTML="<a href="+newPic[npnum].link+" class=a01 target=_blank>"+newPic[npnum].text+"</a>"

       document.getElementById('focuslink').href=newPic[npnum].link

       npnum = (npnum+1) % newPic.length

}

</SCRIPT>

 

 

 

<SCRIPT language=JavaScript>

       newPic=new Array()

 

       newPic[0]=new newsPicItem('071501/1_6-103-2217_2003062532925.jpg', '温网第二日 “小库娃”击败“美国库娃”', 'http://7stk.com')

       newPic[1]=new newsPicItem('071501/1_6-103-2220_20030624182443.jpg', '联合会杯巴西出局 小罗鲁斯图斗殴添新仇', 'http://www.sina.com.cn')

 

</SCRIPt>

 

 

      <TABLE cellSpacing=0 cellPadding=0 width=281 border=0>

        <TBODY>

        <TR>

          <TD align=middle width=259          height=173>

            <SCRIPT language=JavaScript>

              document.write("<a href="+newPic[0].link+" id=focuslink target=_blank><img src="+newPic[0].pic+" name=newspic width=235 height=149 border=0><br>")

       </SCRIPT>

          </TD>

         <TD vAlign=bottom width=22><A

            onmousedown='imgchg(1,"down","document.dbn1")'

            onmouseover='imgchg(1,"on","document.dbn1")'

            onmouseout='imgchg(1,"off","document.dbn1")'

            href="javascript:newsPicChg('document.newspic')"><IMG height=26

            src="071501/nid01_down.gif" width=8 border=0

            name=dbn1></A></TD></TR></TBODY></TABLE>

      <TABLE cellSpacing=0 cellPadding=0 width=281 border=0>

        <TBODY>

        <TR>

          <TD width=12 bgColor=#ffffff height=27></TD>

          <TD width=10></TD>

          <TD align=middle width=232>

            <DIV id=newstext align=center>

            <SCRIPT language=JavaScript>

              document.write("<a href="+newPic[0].link+" class=a01 target=_blank>"+newPic[0].text+"</a>")

       </SCRIPT>

            </DIV></TD></TR></TBODY></TABLE>

 

Write a comment

Comments: 0