提交的表单 如何在通过验证的函数后 在新窗口打开要提交的页面!并关闭此页面(就10分了)
<script LANGUAGE= "JavaScript ">
function check()
{
if (document.form1.name.value== " ")
{
alert( "请输入您的姓名! ")
document.form1.name.focus()
document.form1.name.select()
return
}
if (document.form1.tel.value== " ")
{
alert( "请输入您的电话! ")
document.form1.tel.focus()
document.form1.tel.select()
return
}
document.form1.submit()
}
</script>
<form name= "form1 " method= "post " action= "savedd.asp ">
姓名 <input name= "name " type= "text " id= "name ">
电话 <input name= "tel " type= "text " id= "tel ">
<input type= "button " name= "Submit " value= "提交订单 " onClick= "check() ">
<input type= "reset " name= "Submit2 " value= "重填订单 ">
</form>
这种需要验证的表单 在 <form> 加上target= "_blank " 根本提交不上去
请问 该怎么处理这种需要验证的表单提交 并在新窗口打开提交的页面(savedd.asp) 并关闭此页面
------解决方案-------------------- <form name= "form1 " method= "post " action= "savedd.asp ">
asp??????
我拿你的代码测试了,此页面没有问题,而且提交表单本来就是打开新页面,关闭此页面的,所以不用做任何处理,你可以将savedd.asp改成savedd.jsp,并不要在savedd.jsp里写任何内容,如果能提交,说明是savedd.jsp的问题,你应该去savedd.jsp那里找问题
------解决方案--------------------这是此页面的测试代码,不要将 <html> 等都去掉呀,
<html>
<head>
<title> test </title>
</head>
<script LANGUAGE= "JavaScript ">
function check()
{
if (document.form1.name.value== " ")
{
alert( "请输入您的姓名! ")
document.form1.name.focus()
document.form1.name.select()
return
}
if (document.form1.tel.value== " ")
{
alert( "请输入您的电话! ")
document.form1.tel.focus()
document.form1.tel.select()
return
}
document.form1.submit()
}
</script>
<body>
<form name= "form1 " method= "post " action= "test.jsp ">
姓名 <input name= "name " type= "text " id= "name ">
电话 <input name= "tel " type= "text " id= "tel ">
<input type= "button " name= "Submit " value= "提交订单 " onClick= "check() ">
<input type= "reset " name= "Submit2 " value= "重填订单 ">
</form>
</body>
</html>