您的位置:首页 > Web前端 > JavaScript

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>

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: