zl程序教程

您现在的位置是:首页 >  后端

当前栏目

jspform表单方法示例

方法 示例 表单
2023-06-13 09:14:13 时间
1.代码:
复制代码代码如下:

<%--
Document:index
Createdon:2009-10-4,13:56:46
Author:lucifer
--%>
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN">
<html>
<head>
<title></title>
<metahttp-equiv="Content-Type"content="text/html;charset=UTF-8">
<scripttype="text/javascript">
functiongiveFocus(){
document.login.user.focus()
}
functionsubmitForm(){
document.login.submit()
}
functionresetForm(){
document.login.reset()
document.login.user.focus()
}
</script>
</head>
<bodybgcolor="#c0c0c0"link="#999999"alink="#999999"vlink="#999999"
onload="giveFocus()">
<center>
<fontsize="+2">
<br><br>
<B>LOGIN</B>
</font>
<br><br><br><br>
<formname="login"method="post"
action="http://wenda.tianya.cn/wenda/thread?tid=129583d1f709f89f">
<tablewidth="50%">
<tr>
<tdalign="right">
<fontsize="+1">
<B>UserID</B>
</font>
</td>
<td>
<fontsize="+1">
<inputtype="text"name="user"maxlength="9">
</font>
</td>
</tr>
<tr>
<tdalign="right">
<fontsize="+1">
<B>Password</B>
</font>
</td>
<td>
<fontsize="+1">
<inputtype="password"name="password"
maxlength="8">
</font>
</td>
</tr>
</table>
<br><br><br>
<fontsize="+1">
<B>
<inputtype="button"value="LOGIN"onclick="submitForm()">
     
<inputtype="button"value="RESET"onclick="resetForm()">
<br>
</B>
</font>
</form>
</center>
</body>
</html>

2.结论:
"formname".submit()作用与<inputtype="submit"......>相同,就是提交表单数据,如果button和submit同时存在,只有submit有提交表单的作用