网页表单内容发送到指定邮箱
我的网站在hostmonster主机上,它不支持发送邮件功能,所以在hostmonser主机上用js获取信息后发送到另外一个空间来发送邮件。
问题1.在提交表单后如何再回到当前页面。
问题2.在发送的邮件中如何获取发送表单的网址。
问题2.发送邮件感觉特别慢。
获取内容在网页中用js调用(mail2.js)
----------------------------------
function checkform(){
if (document.myform.email.value == ""){
alert ("This field is required.");
document.myform.email.focus();
return false;
}
var rule=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
if (!rule.test(document.myform.email.value)){
alert ('Please enter a valid e-mail address. For example "frdded@domadin.com".');
document.myform.email.focus();
return false;
}
if (document.myform.message.value == ""){
alert ("This field is required.");
document.myform.message.focus();
return false;
}
}
document.writeln('<form name="myform"
%> 网页表单内容发送到指定邮箱
[解决办法]
问题1.在提交表单后如何再回到当前页面。
re:
window.location.href=document.referrer;
问题2.在发送的邮件中如何获取发送表单的网址。
re:
是说在发送邮件的网站中如何获取hostmonster主机上的表单?
[解决办法]
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
当前url:<input type="text" id="urlRef" name="urlRef" size="100"/>
<script type="text/javascript">
window.onload=function(){
document.getElementById('urlRef').value=window.location.href;
}
</script>
</body>
</html>