这个东西怎么给图片添加链接啊?
<script>
var widths=550; 
var heights=250; 
var counts=3; 
var urls =new Array(); 
img1=new Image ();img1.src='image/6.jpg';
img2=new Image ();img2.src='image/daohangtiao.jpg'; 
img3=new Image ();img3.src='image/chaoshanyizhan.jpg';
 
var nn=1; 
var key=0; 
function change_img() 
{if(key==0){key=1;} 
else if(document.all) 
{document.getElementById("image").filters[0].Apply();document.getElementById("image").filters[0].Play(duration=2);} eval('document.getElementById("image").src=img'+nn+'.src'); 
eval('document.getElementById("url").target="_blank"'); for (var i=1;i<=counts;i++){document.getElementById("xxjdjj"+i).className='axx';} document.getElementById("xxjdjj"+nn).className='bxx'; 
nn++;if(nn>counts){nn=1;} 
tt=setTimeout('change_img()',3000);} 
function changeimg(n){nn=n;window.clearInterval(tt);   change_img();} document.write('<style>'); 
document.write('.axx{padding:1px 7px;border-left:#cccccc 1px solid;}'); 
document.write('a.axx:link,a.axx:visited{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#666;}'); 
document.write('a.axx:active,a.axx:hover{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#999;}'); 
document.write('.bxx{padding:1px 7px;border-left:#cccccc 1px solid;}'); 
document.write('a.bxx:link,a.bxx:visited{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;}'); 
document.write('a.bxx:active,a.bxx:hover{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;}'); 
document.write('</style>'); 
document.write('<div style="width:'+widths+'px;height:'+heights+'px;overflow:hidden;text-overflow:clip;">'); 
document.write('<div><a id="url"><img id="image" style="border:0px;filter:progid:dximagetransform.microsoft.wipe(gradientsize=1.0,wipestyle=4, motion=forward)" width='+widths+' height='+heights+' /></a></div>'); 
document.write('<div style="filter:alpha(style=1,opacity=10,finishOpacity=80);background: #888888;width:100%-2px;text-align:right;top:-12px;position:relative;margin:1px;height:12px;padding:0px;margin:0px;border:0px;">'); 
for(var i=1;i<counts+1;i++){document.write('<a href="javascript:changeimg('+i+');" id="xxjdjj'+i+'" class="axx" target="_self">'+i+'</a>'); } 
document.write('</div></div>'); 
change_img();           </script> 

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【yy709394】截止到2008-07-04 14:40:27的历史汇总数据(不包括此帖):
    发帖的总数量:0                        发帖的总分数:0                        
    结贴的总数量:0                        结贴的总分数:0                        
    无满意结贴数:0                        无满意结贴分:0                        
    未结的帖子数:0                        未结的总分数:0                        
    结贴的百分比:---------------------结分的百分比:---------------------
    无满意结贴率:---------------------无满意结分率:---------------------
    如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html
      

  2.   

    你可以给图片的url属性设置值呀
      

  3.   

    图片加链接?图片链接是放在link中的可以给img添加事件来解决
    oImg.onclick=function(){
       //to-do:你的页面跳转代码
    }
      

  4.   

    <script> 
    var widths=550; 
    var heights=250; 
    var counts=3; 
    var urls =new Array(); 
    img1=new Image ();img1.src='image/6.jpg'; 
    img2=new Image ();img2.src='image/daohangtiao.jpg'; 
    img3=new Image ();img3.src='image/chaoshanyizhan.jpg'; var nn=1; 
    var key=0; 
    function change_img() 
    {
    if(key==0)
    {key=1;} 
    else if(document.all) 
    {
    document.getElementById("image").filters[0].Apply();
    document.getElementById("image").filters[0].Play(duration=2);
    } eval('document.getElementById("image").src=img'+nn+'.src'); 
    eval('document.getElementById("url").target="_blank"'); for (var i=1;i <=counts;i++)
    {document.getElementById("xxjdjj"+i).className='axx';} 
    document.getElementById("xxjdjj"+nn).className='bxx'; 
    nn++;if(nn>counts)
    {  nn=1;} 
    tt=setTimeout('change_img()',3000);

    function changeimg(n){nn=n;window.clearInterval(tt);  change_img();} document.write(' <style>'); 
    document.write('.axx{padding:1px 7px;border-left:#cccccc 1px solid;}'); 
    document.write('a.axx:link,a.axx:visited{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#666;}'); 
    document.write('a.axx:active,a.axx:hover{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#999;}'); 
    document.write('.bxx{padding:1px 7px;border-left:#cccccc 1px solid;}'); 
    document.write('a.bxx:link,a.bxx:visited{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;}'); 
    document.write('a.bxx:active,a.bxx:hover{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;}'); 
    document.write(' </style>'); 
    document.write(' <div style="width:'+widths+'px;height:'+heights+'px;overflow:hidden;text-overflow:clip;">'); 
    document.write(' <div> <a id="url" href="#" > <img id="image" style="border:0px;filter:progid:dximagetransform.microsoft.wipe(gradientsize=1.0,wipestyle=4, motion=forward)" width='+widths+' height='+heights+' /> </a> </div>'); 
    document.write(' <div style="filter:alpha(style=1,opacity=10,finishOpacity=80);background: #888888;width:100%-2px;text-align:right;top:-12px;position:relative;margin:1px;height:12px;padding:0px;margin:0px;border:0px;">'); 
    for(var i=1;i <counts+1;i++){document.write(' <a href="javascript:changeimg('+i+');" id="xxjdjj'+i+'" class="axx" target="_self">'+i+' </a>'); } 
    document.write(' </div> </div>'); 
    change_img(); 
              </script> 
    代码不错 我收藏了  不过你的人确实很懒列
    都不整理一下就拿出来  谁有心思看撒
      

  5.   

    <style type="text/css"> 
    <!-- 
    .axx{ 
    padding:1px 7px;border-left:#cccccc 1px solid;} 
    a.axx:link,a.axx:visited{ 
    text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#666;} 
    a.axx:active,a.axx:hover{ 
    text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#999;} 
    .bxx{ 
    padding:1px 7px;border-left:#cccccc 1px solid;} 
    a.bxx:link,a.bxx:visited{ 
    text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;} 
    a.bxx:active,a.bxx:hover{ 
    text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;} 
    --> 
    </style> <script> 
    var widths=310; 
    var heights=210; 
    var counts=3; 
    var urls =new Array(); 
    img1=new Image ();img1.src='1.jpg'; 
    img1.url="news.qq.com"
    img2=new Image ();img2.src='2.jpg'; 
    img3=new Image ();img3.src='3.jpg'; 
    var sum=0;
    var nn=1; 
    var key=0; 
    function change_img() 

      if(key==0) 
      {key=1;} 
    else if(document.all) 
      { 
      document.getElementById("image").filters[0].Apply(); 
      document.getElementById("image").filters[0].Play(duration=2); 
      } 
      eval('document.getElementById("image").src=img'+nn+'.src'); 
      eval('document.getElementById("url").target="_blank"'); 
    if(sum==0)
    eval('document.getElementById("url").href="http://news.qq.com"'); 
    else if(sum==1)
    eval('document.getElementById("url").href="http://www.baidu.com"'); 
    else
    eval('document.getElementById("url").href="http://www.google.com"'); 
    sum++
    if(sum>2)
    sum=0
    for (var i=1;i <=counts;i++) 
      { 
      document.getElementById("xxjdjj"+i).className='axx'; 
      } 
      document.getElementById("xxjdjj"+nn).className='bxx'; 
      nn++; 
      if(nn>counts) 
      {  nn=1;} 
      tt=setTimeout('change_img()',3000); 

    function changeimg(n){ 
    nn=n; 
    window.clearInterval(tt);  
    change_img();} document.write(' <div style="width:'+widths+'px;height:'+heights+'px;overflow:hidden;text-overflow:clip;">'); document.write(' <div> <a id="url" > <img id="image" style="border:0px;filter:progid:dximagetransform.microsoft.wipe(gradientsize=1.0,wipestyle=4, motion=forward)" width='+widths+' height='+heights+' /> </a> </div>'); document.write(' <div style="filter:alpha(style=1,opacity=10,finishOpacity=80);background: #888888;width:100%-2px;text-align:right;top:-12px;position:relative;margin:1px;height:12px;padding:0px;margin:0px;border:0px;">'); for(var i=1;i <counts+1;i++){document.write(' <a href="javascript:changeimg('+i+');" id="xxjdjj'+i+'" class="axx" target="_self">'+i+' </a>'); } 
    document.write(' </div> </div>'); 
    change_img();           </script>