做一个查询界面,决定用弹出窗口,但是查询结果是私有的,不是所有用户都能够访问,因此需要将用户的id传递过去,作为合法用户的判断,但是不知道如何传递课。新手
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>welcome !</title>
<script>
    function opensearch()
    {
     window.open("ghao.jsp");
    }
    function openuser()
    {
     window.open("userserach.jsp");
    }
    function opendoc()
    {
     window.open("opendoc.jsp");
    }
    function postdoc()
    {
     window.open("postdoc.jsp");
    }
</script>
</head>
<body>
<%if(request.getParameter("id")!=null){ %>
<%String temp=request.getParameter("id");%>
<center>
<p>
   <input type="button" value="一般挂号信息查询" onclick="opensearch()">
   <input type="button" value="用户挂号信息查询" onclick="openuser()">
   <input type="button" value="用户就诊信息查询" onclick="opendoc()">
</p>
</center>
<br>
<center>
<p>
   <input type="button" value="提交挂号信息" onclick="opensearch()">  
</p>
 </center>

解决方案 »

  1.   

    在你的jsp页面把id传过去就可以了。
    function opensearch()
      {
      var temp = $('id');
      window.open("ghao.jsp?id='"+temp+"'");
      }
    在页面加个隐藏文本框
    <input type="hidden" value="<%=temp%>" id='hid'>
      

  2.   

    你在ghao.jsp页面应该有个接应id的<%String temp=request.getParameter("id");%>
    就像这样,你才能接到值
      

  3.   

    var temp = $('id');
    这句话是不是有问题啊??我测试了一下,加上它马上就链接不上了?
      

  4.   

     var temp = $('id');
    这一句是有问题的,我把它改为var temp=document.getElementById("id").value;就可以了,谢谢了。哎,一个小问题搞了我一个下午,初学者伤不起啊
      

  5.   

    window.open("ghao.jsp?id=<%=temp%>");
      

  6.   

    当然<%if(request.getParameter("id")!=null){ %>
    <%String temp=request.getParameter("id");%>
    要放在前面去,后面才能通过<%=temp%>来获取
      

  7.   

    建议你在调用onclick="opensearch()"的时候就把id穿进去onclick="opensearch(‘《%=id%》’)"