不是一样吗?这部就给图片加上了连接?
<a href="test"><img src="test.jpg"></a>

解决方案 »

  1.   

    谢谢回复。下面这段代码是用来实现图片超过大小自动缩放的,我想要实现:<script language="JavaScript" src="includes/default_javascript.js" type="text/javascript"></script>
    <script language="Javascript"> 
         function resizeImages() 
         { 
              if (document.images.length > 0)          //Has images, validate sizes 
              { 
                   var imgHeight; 
                   var imgWidth; 
                   for (var loop = 0; loop < document.images.length; loop++) 
                   { 
                        if (document.images[loop].name.substring(0,6) == 'chkImg') 
                        { 
                             imgWidth = document.images[loop].width; 
                             imgHeight = document.images[loop].height; 
                              
                             if (imgWidth > <% = intImgWidth %>) 
                             { 
                                  document.images[loop].width = <% = intImgWidth %>; 
                                  //Proportionalize Height 
                                  imgHeight = imgHeight / (imgWidth/<% = intImgWidth %>); 
                                  document.images[loop].height = imgHeight;                                想在这个地方给图片指定一个链接,点击后在新窗口打开图片本身,应该怎么写?
                             } 
                        } 
                   } 
              } 
         } 
    </script>
      

  2.   

    <img src="test.jpg" style="cursor:hand" onclick="self.location='test.htm'")>
      

  3.   

    ...
    document.images[loop].onclick=gotourl(url);
    ...
    function gotourl(url){
    document.location.href=url;
    }