你那个link第二次点击时就被你的js改变了。试试这段代码,没问题了<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
     <title>Good Luck </title> 
     <meta name="generator" content="editplus" /> 
     <meta name="author" content="Gao YiXiang" /> 
     <meta name="email" content="[email protected]" /> 
     <meta name="keywords" content="javascript dhtml dom" /> 
     <meta name="description" content="I love web development." /> 
</head> 
<body> 
     <a href="http://www.126.com?s=good&a=luck" onclick="contactUs(this)" rel="http://www.126.com?s=good&a=luck">Contact  
    Us </a> 
     <script type="text/javascript"> 
     <!-- 
function contactUs(link) 

    link.href = "mailto:[email protected]?subject=" + document.title + "&body=" + escape(link.rel); 
    //alert(link.href); 

    //--> 
     </script> 
</body> 
</html> 

解决方案 »

  1.   

    link.href = "mailto:[email protected]?subject=" + document.title + "&body=" + encodeURIComponent(link.href); 点击之后link.href 发生了变化  下次 encodeURIComponent(link.href) 就会变化
      

  2.   

    现谢谢,我的url链接它是动态的,不是固定的。
      

  3.   

    道理是一样的,即使是动态的链接,给这个链接的值赋给rel属性,一样可以实现
      

  4.   

    <a href="../22/san.php?id={$result.id}" onclick="contactUs(this)" rel="../22/san.php?id={$result.id}">Contact   
        Us  </a>  这样的话也可以吗?
      

  5.   

    试试这个<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head>  
          <title>Good Luck  </title>  
          <meta name="generator" content="editplus" />  
          <meta name="author" content="Gao YiXiang" />  
          <meta name="email" content="[email protected]" />  
          <meta name="keywords" content="javascript dhtml dom" />  
          <meta name="description" content="I love web development." />  
    </head>  
    <body>  
          <a href="http://www.126.com?s=good&a=luck" onclick="contactUs(this)">Contact   
        Us  </a>  
          <script type="text/javascript">  
          <!--  
    function contactUs(link)  
    {  
    if(link.rel== "") link.rel = link.href;
        link.href = "mailto:[email protected]?subject=" + document.title + "&body=" + escape(link.rel);  
        //alert(link.href);  
    }  
        //-->  
          </script>  
    </body>  
    </html>