给以下代码添加点击提交后跳转至新界面的功能<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>用户注册</title> </head> <body> <p align="center"> <font size=" 4" color="#FF3300">用户注册</font> </p> <form id="form1" name="form1" method="post" action="addUserServlet"> <table width="340" border="0" align="center"> <tr> <td width="150">卡号:</td> <td width="189"><label> <input name="user" type="text" id="user" /> </label></td> </tr> <tr> <td>密码:</td> <td><label> <input name="pwd" type="password" id="pwd" /> </label></td> </tr> <tr> <td>重输密码:</td> <td><label> <input name="pwd1" type="password" id="pwd1" /> </label></td> </tr> <tr> <td>账户名:</td> <td><label> <input name="name" type="text" id="name" /> </label></td> </tr> <tr> <td><label> <input type="submit" name="Submit" value="提交" /> </label></td> <td><label> <input type="reset" name="Submit2" value="重置" /> </label></td> </tr> </table> </form> </body> </html>
时间: 2023-07-19 13:38:35 浏览: 60
您可以将以下代码添加到表单中的“提交”按钮中,以实现点击提交后跳转到新页面的功能:
```html
<input type="submit" name="Submit" value="提交" onclick="location.href='new_page.jsp'"/>
```
在这里,我们使用了JavaScript的`location.href`属性将页面重定向到`new_page.jsp`页面。您可以将其替换为您想要跳转的页面的URL。
完整的代码如下所示:
```html
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>用户注册</title>
</head>
<body>
<p align="center">
<font size=" 4" color="#FF3300">用户注册</font>
</p>
<form id="form1" name="form1" method="post" action="addUserServlet">
<table width="340" border="0" align="center">
<tr>
<td width="150">卡号:</td>
<td width="189"><label>
<input name="user" type="text" id="user" />
</label></td>
</tr>
<tr>
<td>密码:</td>
<td><label>
<input name="pwd" type="password" id="pwd" />
</label></td>
</tr>
<tr>
<td>重输密码:</td>
<td><label>
<input name="pwd1" type="password" id="pwd1" />
</label></td>
</tr>
<tr>
<td>账户名:</td>
<td><label>
<input name="name" type="text" id="name" />
</label></td>
</tr>
<tr>
<td><label>
<input type="submit" name="Submit" value="提交" onclick="location.href='new_page.jsp'"/>
</label></td>
<td><label>
<input type="reset" name="Submit2" value="重置" />
</label></td>
</tr>
</table>
</form>
</body>
</html>
```
相关推荐
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> one.jsp two.jsp three.jsp error.jsp </head> <body> 请输入1至100之间的整数:<input type="text" name="name"> <input type="submit" value=提交> <% String str=request.getParameter("name"); if(1<=str<=50){ %> <form action="two.jsp" method=post/> <% } else if(50<str<=100){ %> <form action="three.jsp"method=post/> <% } else{ %> <form action="error.jsp"method=post/> <% } %> </body> </html>
<%-- Created by IntelliJ IDEA. User: syp Date: 2023/5/22 Time: 13:59 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>Denglu</title> </head> <body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0"> <fieldset style="width: auto; margin: 0px auto"> <legend> 欢迎使用常州工业职业技术学院人员管理系统 </legend>
<form action="loginSuccess.action"> 用户:<input type="text" name="username"/>
密码:<input type="password" name="password"/>
<input type="submit" value="登录"/> 注册 </form> </fieldset> </body> </html>
<form action="loginSuccess.action"> 用户:<input type="text" name="username"/>
密码:<input type="password" name="password"/>
<input type="submit" value="登录"/> 注册 </form> </fieldset>