sxpujs 发表于 2013-2-6 08:41:47

一个form两个提交按钮,分别提交到两页面

A.jsp
<%@ page pageEncoding="GBK"%><html><head><script type="text/javascript">function save(){document.form1.action="B.jsp";document.form1.submit();}function send(){document.form1.action="C.jsp";document.form1.submit();}</script></head><body><form name="form1"><input type="text" name="username" value="scott"><input type="button" value="发送" ><input type="button" value="保存" ></form></body></html> 
 
B.jsp
<%@ page pageEncoding="GBK"%><html><head></head><body bgcolor="blue">save.jsp<br><%=request.getParameter("username")%></body></html> 
 
C.jsp
<%@ page pageEncoding="GBK"%><html><head></head><body bgcolor="red">send.jsp<br><%=request.getParameter("username")%></body></html> 
页: [1]
查看完整版本: 一个form两个提交按钮,分别提交到两页面