JSP单选框问题!!!!!!!!!!!!!!!!!!!!
点击相应的单选框,点击提交,跳转到相应界面,但是没反应,为什么呢<%@pagelanguage="java"import="java.util.*"pageEncodin...
点击相应的单选框,点击提交,跳转到相应界面,但是没反应,为什么呢
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'gztb.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<style type="text/css">
a:link {font-size:12px; text-decoration:none; color:#03515d;}
a:visited{font-size:12px; text-decoration:none; color:#03515d;}
</style>
<script language="JavaScript">
function check(){
var gztbs = document.getElementsByName("gztb");
for (var i=0; i<gztbs.length; i++) {
if (gztbs[i].checked) {
window.location.replace="gztbs[i].value";
}
}
}
</script>
</head>
<body>
<form name="myform" action="" method="" onsubmit="return check()">
<table width="100%" border="0">
<tr>
<td> <input type="radio" name="gztb" value="/njusc/admin/ribao/ribaoAdd.jsp" target='I2' />工作日报</td>
<td> <input type="radio" name="gztb" value="/njusc/admin/zhoubao/zhoubaoAdd.jsp" target='I2' />工作周报</td>
<td> <input type="radio" name="gztb" value="/njusc/admin/yuebao/yuebaoAdd.jsp" target='I2' />工作月报</td>
<td> <input type="radio" name="gztb" value="/njusc/admin/nianbao/nianbaoAdd.jsp" target='I2' />工作年报</td>
<td><input type="submit" value="提交"></td>
</tr>
</table>
</form>
</body>
</html> 展开
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'gztb.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<style type="text/css">
a:link {font-size:12px; text-decoration:none; color:#03515d;}
a:visited{font-size:12px; text-decoration:none; color:#03515d;}
</style>
<script language="JavaScript">
function check(){
var gztbs = document.getElementsByName("gztb");
for (var i=0; i<gztbs.length; i++) {
if (gztbs[i].checked) {
window.location.replace="gztbs[i].value";
}
}
}
</script>
</head>
<body>
<form name="myform" action="" method="" onsubmit="return check()">
<table width="100%" border="0">
<tr>
<td> <input type="radio" name="gztb" value="/njusc/admin/ribao/ribaoAdd.jsp" target='I2' />工作日报</td>
<td> <input type="radio" name="gztb" value="/njusc/admin/zhoubao/zhoubaoAdd.jsp" target='I2' />工作周报</td>
<td> <input type="radio" name="gztb" value="/njusc/admin/yuebao/yuebaoAdd.jsp" target='I2' />工作月报</td>
<td> <input type="radio" name="gztb" value="/njusc/admin/nianbao/nianbaoAdd.jsp" target='I2' />工作年报</td>
<td><input type="submit" value="提交"></td>
</tr>
</table>
</form>
</body>
</html> 展开
1个回答
2012-05-03
展开全部
lz这句话错了window.location.replace="gztbs[i].value";
应该是这样的吧window.location.replace="gztbs["+i+"].value";
应该是这样的吧window.location.replace="gztbs["+i+"].value";
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询