你那个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>
<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>
Us </a> 这样的话也可以吗?
<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>