查看: 690|回复: 3
|
请问我这个编程有什么问题吗?他不会去orderbook.html o
[复制链接]
|
|
<HTML>
<HEAD>
<TITLE>Order</TITLE>
</HEAD>
<A name ="top"></A>
<BODY BACKGROUND="bgpic3.gif">
<H3>
Kindly fill up your information before order book thanks~~
</H3><p>
<FORM NAME="order" ACTION="orderbook.html" METHOD="get">
<TABLE BORDER = "0">
<TR>
<TD>First Name : <TD><INPUT TYPE = "text" NAME = "firstname" SIZE="20">
</TR>
<TR>
<TD>Last Name : <TD><INPUT TYPE = "text" NAME = "lastname" SIZE="20">
</TR>
<TR>
<TD>Gender : <TD> <INPUT TYPE = "radio" NAME = "gender" VALUE = "male"> Male
<INPUT TYPE = "radio" NAME = "gender" VALUE = "female"> Female
</TR>
<TR>
<TD>D.O.B : <TD> <INPUT TYPE = "text" NAME = "dateofbirth" SIZE="2"> / <INPUT TYPE = "text" NAME = "dateofbirth" SIZE="2"> / <INPUT TYPE = "text" NAME = "dateofbirth" SIZE="4">
</TR>
<TR>
<TD>Age: <TD> <INPUT TYPE = "text" NAME = "age">
</TR>
<TR>
<TD>Address : <TD> <INPUT TYPE = "text" NAME = "address" SIZE="20">
</TR>
<TR>
<TD> <TD> <INPUT TYPE = "text" NAME = "add">
</TR>
<TR>
<TD>Email: <TD> <INPUT TYPE = "text" NAME = "email">
</TR>
</TABLE>
<INPUT TYPE ="button" value ="Done" onClick ="check(this.form)">
</FORM>
<script language ="JavaScript">
<!--
function check(form)
{//validate a text form
// if blank send an error message and ask to reenter
if (form.elements[0].value == "") {
alert("You didn't enter your Firstname .");
form.firstname.focus();
form.firstname.select();
return;
}
if (form.elements[1].value == "") {
alert("You didn't enter your Lastname .");
form.lastname.focus();
form.lastname.select();
return;
}
if (form.elements[10].value == "") {
alert("You didn't enter your Email Address .");
form.email.focus();
form.email.select();
return;
}
}
//-->
</script>
</BODY>
</HTML>
[ 本帖最后由 boe 于 22-5-2006 12:42 AM 编辑 ] |
|
|
|
|
|
|
|
发表于 22-5-2006 01:07 AM
|
显示全部楼层
1. 你的 javascript function, check(form) 写错, 呼叫方法也错, 需重新好好查一下该如何写.
2. 你的 form 不能被 submit 是因为你的 button type 是 button, 应该是 submit. |
|
|
|
|
|
|
|
发表于 22-5-2006 01:13 AM
|
显示全部楼层
<INPUT TYPE ="button" value ="Done" onClick ="check(this.form)">
显而易见的错误嘛..
以上不是type=submit,而是type=button
如果要用type=button,要在js上最后加上 document.order.submit();
.. |
|
|
|
|
|
|
|
楼主 |
发表于 22-5-2006 02:16 AM
|
显示全部楼层
|
|
|
|
|
|
| |
本周最热论坛帖子
|