| |

VerySource

 Forgot password?
 Register
Search
View: 851|Reply: 2

Novice question, please do me a favor!!!

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-10-19 11:30:01
| Show all posts |Read mode
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+"&nbsp;";}
}
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&yen;">2000~3000&yen;</option>
<option value="3000~4000&yen;">3000~4000&yen;</option>
<option value="4000~5000&yen;">4000~5000&yen;</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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="reset" name="chong" value="rewrite"></p>
</form>
</body>
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 Invalid IP Address

Post time: 2020-10-19 18:00:01
| Show all posts
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<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+"&nbsp;";}
}
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&yen;">2000~3000&yen;</option>
<option value="3000~4000&yen;">3000~4000&yen;</option>
<option value="4000~5000&yen;">4000~5000&yen;</option>
</select>
</td>
</tr>
<tr>
<td>
EMAIL:<input type="text" name="email">
</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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="reset" name="chong" value="rewrite"></p>
</form>
</body>


</html>
Reply

Use magic Report

0

Threads

1

Posts

0.00

Credits

Newbie

Rank: 1

Credits
0.00

 United States

Post time: 2021-2-7 23:28:10
| Show all posts
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list