|
Look at my form, why is it just refreshed after submitting without displaying the registration information, and only the content of the first line is verified, but the latter is not verified?????? Help find the error, I have been looking for a long time I just don't know what's wrong???
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Mail account information</title>
<script>
function my()
{
f=document.myform;
if(f.ming.value==""||f.email.value=="")
{
alert("Please fill in completely!");
return false;
}
var re=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
if(!re.test(f.email.value))
{
alert("Email format error!!!");
return false;
}
if(f.mybox[0].checked==false&&f.mybox[1].checked==false&&f.mybox[2].checked==false&&f.mybox[3].checked==false&&f.mybox[4].checked ==false)
{
alert("Choose at least one item!");
return false;
}
var s="";
for(var i=0;i<f.mybox.length;i++)
{
if(f.mybox[i].checked==true)
{s=s+f.mybox[i].value+" ";}
}
if(f.tu.value=="")
{
alert("The picture cannot be empty!");
return false;
}
var a=f.ming.value;
var b=f.lei.value;
var c=f.jin.value;
var d=f.email.value;
var e=f.mybox.value;
var g=f.tu.value;
document.write("<h2>Your registration information is as follows: "+"</h2>");
document.write("<hr>");
document.write("Property name:"+a+"<br>");
document.write("Property category:"+b+"<br>");
document.write("Rent Range:"+c+"<br>");
document.write("EMAIL:"+d+"<br>");
document.write("Bus route"+e+"<br>");
document.write("Picture:"+g);
}
</script>
</head>
<body bgcolor="#CAE4FF">
<h1 align="center"><font color="#0033FF" face="华文彩云">Please enter housing information</font></h1>
<form name="myform" onSubmit="return my()">
<table bgcolor="#CAE4FF" align="center" border="2">
<tr>
<td>Property name: <input type="text" name="ming" value=""></td>
</tr>
<tr>
<td>
Property Type: <select name="lei">
<option selected value="Apartment">Apartment</option>
<option value="Hostel">Hotel</option>
<option value="hotel">Hotel</option>
</select>
</td>
</tr>
<tr>
<td>
Rent range: <select name="jin">
<option selected value="2000~3000¥">2000~3000¥</option>
<option value="3000~4000¥">3000~4000¥</option>
<option value="4000~5000¥">4000~5000¥</option>
</select>
</td>
</tr>
<tr>
<td>
EMAIL:<input type="text" name="eamil">
</td>
</tr>
<tr>
<td>
Bus line: <input type="checkbox" name="mybox" value="300" id="300"><label for="300">300</label>
<input type="checkbox" name="mybox" value="720" id="720"><label for="720">720</label>
<input type="checkbox" name="mybox" value="356" id="356"><label for="356">356</label>
<input type="checkbox" name="mybox" value="114" id="114"><label for="114">114</label>
<input type="checkbox" name="mybox" value="120" id="112"><label for="112">112</label>
</td>
</tr>
<tr>
<td>
Physical picture: <input type="file" name="tu" value="">
</td>
</tr>
</table>
<p align="center"><input type="submit" name="submit" value="complete">
<input type="reset" name="chong" value="rewrite"></p>
</form>
</body> |
|