jsp通过选中radio进入不同的form.action
2014-08-31 15:05
225 查看
<script> function sentWord() { targetForm = document.forms[0]; targetForm.action = "searchSentResult.jsp"; } function sensitiveWord() { targetForm = document.forms[0]; targetForm.action = "searchSensitiveWordResult.jsp"; } function hotWord() { targetForm = document.forms[0]; targetForm.action = "searchHotWordResult.jsp"; } </script>
<input type="radio" name="kind" value="1"checked="checked" onclick="sentWord()"/>情感词库 <input type="radio" name="kind"value="2" onclick="sensitiveWord()"/>敏感词库 <input type="radio" name="kind" value="3" onclick="hotWord()"/>热度词库
radio的选中通过onclick进入相应的script,由下面的语句
targetForm.action = "searchSensitiveWordResult.jsp";转到另一个网页。
<%@page import="javax.swing.text.Document"%>
<%@ page contentType="text/html; charset=gb2312"%>
<%
session.invalidate();
%>
<%@ page import="cwsBean.*"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<LINK href="hellking2.css" type=text/css rel=stylesheet>
<body>
<script>
function sentWord() {
targetForm = document.forms[0];
targetForm.action = "searchSentResult.jsp";
}
function sensitiveWord() {
targetForm = document.forms[0];
targetForm.action = "searchSensitiveWordResult.jsp";
}
function hotWord() {
targetForm = document.forms[0];
targetForm.action = "searchHotWordResult.jsp";
}
</script>
<center>
<hr>
<form name="form1" action="searchSentResult.jsp" method="get">
<table width="50%" border="1">
</tr>
<tr bgcolor="#336600">
<td align="add" colspan="2">
<input type="submit" value="search">
<input type="text"name="name"value="<%=request.getParameter("name") == null ? "" : request
.getParameter("name")%>"style="width: 234px; "></td>
</tr>
</table>
<tr align="center">
<td><input type="radio" name="kind" value="1"checked="checked" onclick="sentWord()"/>情感词库 <input type="radio" name="kind"value="2" onclick="sensitiveWord()"/>敏感词库 <input type="radio" name="kind" value="3" onclick="hotWord()"/>热度词库
</td>
</tr>
</form>
</center>
</body>
</html>
相关文章推荐
- 通过<a href=""></a>和<form action/>的不同+页面日期格式化
- jsp关于form表单为两个按钮设置不同action的问题
- JavaScript判断Form中的Radio是否有未选中的
- 一个Java小例子(通过Radio进行选中查询)
- 当一个表单中有多个按钮时,可以通过onclick()事件触发不同的action请求
- spring3 jsp页面使用<form:form modelAttribute="xxxx" action="xxxx">报错,附连接数据库的spring MVC annotation 案例
- 普通html中<form>标签和struts2中<s:form>标签action属性的不同
- [原创]JSP页面通过Form控制Beans属性
- 在同一form表单中如何提交两个不同的action
- jsp里有两个表单分别传到不同的servlet中!请问怎么解决form获取的先后?
- 通过JS来修改表单form的action
- jsp中,使用javascript判断radio是否有选中!
- jsp表单中form标签的action属性的值
- 创建JSP文件和ActionForm Bean
- jsp页面向action通过get方式传参,出现乱码的处理办法
- JavaScript判断Form中的Radio是否有未选中的
- struts中通过AcitonForm提交数据时,Action打印出乱码
- 有关Ext.form.RadioGroup(读取选中值、动态选中)
- jsp通过logic:iterate或html:optionsCollection循环显示action中传过来的对象List
- JS实现一个表单form,多个submit按钮提交时带不同的action参数