脚本源代码: 第一步:把如下代码加入到<head>区域中 <head> <form name="eMailer">
要完成此效果需要两个步骤
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var good;
function checkEmailAddress(field) {
// the following expression must be all on one line...
var goodEmail = field.value.match(/b(^(S+@).+((.com)|(.net)|(.edu)|(.mil)|(.gov)|(.org)|(..{2,2})) $)b/gi);
if (goodEmail) {
good = true;
}
else {
alert('请正确输入E-mail地址.');
field.focus();
field.select();
good = false;
}
}
u = window.location;
m = "你觉得你会对这个感兴趣的...";
function mailThisUrl() {
good = false
checkEmailAddress(document.eMailer.address);
if (good) {
// the following expression must be all on one line...
window.location = "mailto:"+document.eMailer.address.value+"?subject="+m+"&body="+document.title+" "+u;
}
}
// End -->
</script>
第二步:把如下代码加入到<body>区域中
<div align="center">把当前URL发送到以下信箱 <br>
<input type="text" name="address" size="25">
<br>
<input type="button" value="Send this URL" onClick="mailThisUrl();">
</div>
</form>