<form action="a.jsp" name=form1>
<select name=sel>
<option value=1>1
<option value=2>2
<option value=3>3
</select>
<a href="javascript:document.form1.submit();">submit</a>
</form>
------------------------
接收:
request.getParameter("sel");
<select name=sel>
<option value=1>1
<option value=2>2
<option value=3>3
</select>
<a href="javascript:document.form1.submit();">submit</a>
</form>
------------------------
接收:
request.getParameter("sel");
<select name=sel>
<option value=1>1
<option value=2>2
<option value=3>3
</select>
<a href="javascript:document.form1.submit();">submit</a>
</form>
------------------------
接收:
request.getParameter("sel");
请问有没有办法可以点击不同的链接,action到不同的页面,或者同一个页面但是参数不同
例如:
<a href="javascript:document.form1.submit();">a</a> 到达a.jsp?type=1
<a href="javascript:document.form1.submit();">b</a> 到达a.jsp?type=2
<!--a.jsp -->
<html>
<BODY>
<form name="form1" action="m1.jsp" Method="post" >
<select name="iselect">
<option value="a">a</option>
<option value="b">b</option>
</select>
</form>
<form name="form2" action="m2.jsp" method="post">
<input type="text" name="itext">
</form>
<a href="javascript:document.form1.submit();">a</a>
<a href="javascript:document.form2.submit();">b</a></BODY>
</HTML>
<input type=button value=A onclick=a()>
<input type=button value=B onclick=b()>
</form><script language=javascript>
function a()
{
document.form1.action="a.jsp?act=1"
document.form1.submit();
}
function b()
{
document.form1.action="a.jsp?act=2"
document.form1.submit();
}
</script>
本贴是第一问<select name="order_select" onChange="show_order_selected(this)">
<option value="sel" selected>请选择:</option>
<option value="2890">0076953</option>
<option value="2902">3525783</option>
</select>主要是 onChange 属性。下一页得到值:String sel = request.getParameter("sel");
<select name=sel>
<option value=1>1
<option value=2>2
<option value=3>3
</select>
<a href="javascript:document.form1.action='a.jsp?type=1';document.form1.submit();">a</a>
<a href="javascript:document.form1.action='a.jsp?type=2';document.form1.submit();">b</a>
</form>
感谢你,我的需求和你的有点不一样,无法采纳to caoze(大漠孤烟) :
也感谢你,我的需求是用链接,不是按钮to beyond_xiruo(希偌):
非常感谢你,正合适:)感谢大家的参与,我会在结帖的时候追加一些分的!再问一个问题:
在上面 beyond_xiruo(希偌) 答复的基础上,还有一个连接c,它连到一个frameset的html页面,此页面分上下frame,在上frame里嵌入a.jsp?type=3
由于frameset只能是html文件,所以现在无法将下拉框里的值传到a.jsp,请问有什么办法可以实现这个功能?非常感谢!
<%@ page language="java"%>
<frameset rows="64,*">
<frame name="header" scrolling="no" noresize target="main" src="a.jsp?type=<%=request("type")%>">
<frame name="main" src="new_page_4.htm">
<noframes>
<body> <p>此网页使用了框架,但您的浏览器不支持框架。</p> </body>
</noframes>
</frameset>
<frame name="header" scrolling="no" noresize target="main" src="a.jsp?type=<%=request("type")%>">1、上面程序片段中的target是什么?好象没有这个属性!
2、好象没有request("type")这种方式,有request.getParameter
我想应该是request.getParameter("type")
我知道target本身的作用,可是在frame里面好象没有这个属性吧?