JavaScript问题

wuj 2004-09-05 10:00:37
下面是一个jsp查询页面
<%@page contentType="text/html;charset=gb2312"%>
<%@ page session="true" %>
<%@ page import = "hospital.org.*,hospital.org.util.*,hospital.util.*,hospital.work.*,hospital.menzhen.*,java.util.*,java.io.*,java.sql.*"%><html>
<head>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
<script language="JavaScript">
<!--
function check2(form){
if(form.dept.checked){
form.chk_dept.value="true";
}else{
form.chk_dept.value="false";
}
}
function check3(form){
if(form.time.checked){
form.chk_time.value="true";
}else{
form.chk_time.value="false";
}
}
function check4(form){
if(form.worker.checked){
form.chk_worker.value="true";
}else{
form.chk_worker.value="false";
}
}
// -->
</script>
</head>
<body bgcolor="#FF9933" text="#000000">
<div id="Layer1" style="position:absolute; left:33px; top:33px; width:112px; height:27px; z-index:1"><font size="3">查询条件选择</font></div>
<div id="Layer2" style="position:absolute; left:34px; top:62px; width:544px; height:99px; z-index:2">
<form name="form1" method="post" action="guahao_query.jsp">
<p>
<input type="checkbox" name="worker" OnClick="check4(this.form)">
工作人员
<input type="text" name="worker" size="8">
</p>
<p>
<input type="checkbox" name="dept" OnClick="check2(this.form)">
挂号科室
<select name="sel_dept" size="1">
<option value="neike">内科</option>
<option value="waike">外科</option>
<option value="yanke">眼科</option>
<option value="erke">儿科</option>
</select>
</p>
<p>
<input type="checkbox" name="time" OnClick="check3(this.form)">
挂号时间
<input type="text" name="begintime" size="8">

<input type="text" name="endtime" size="8">
</p>
<p>
<input type="hidden" name="chk_dept" >
<input type="hidden" name="chk_time">
<input type="hidden" name="chk_worker">
<input type="submit" name="Submit" value="查询">
</p>
</form>
</div>
<div id="Layer4" style="position:absolute; left:379px; top:33px; width:78px; height:27px; z-index:6"></div>
</body>
</html>

查询工作人员和时间都没问题,比如点击挂号时间,chk_time值为 true ,但是选择工作人员时,chk_worker为false,应该为true ,请问怎么回事
...全文
148 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
xunyiren 2004-09-06
  • 打赏
  • 举报
回复
<input type="checkbox" name="worker" OnClick="check4(this.form)">
工作人员
<input type="text" name="worker" size="8">
问题在于上面两个表单域的名字是一样的,你把工作人员的文本域的name改成别的就好了!
AlexHeHe 2004-09-06
  • 打赏
  • 举报
回复
<input type="checkbox" name="worker" OnClick="check4(this.form)">
工作人员
<input type="text" name="worker" size="8">

两个同名了
skyboy0720 2004-09-06
  • 打赏
  • 举报
回复
哪有chk_worker?!

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧