brother or sister, 
"bmdh" is in the client-side code, yet to be run on someone else's machine when the user gets this page, and you try to use the variable right away on the server side, on your server machine???

解决方案 »

  1.   

    thank you,karma!
    but after I change it ,it still cannot get!!
      

  2.   

    post your complete code if you do not mind
      

  3.   

    <%@Language=VBScript %>
    <%on error resume next%>
    <!--#include file="../sybase.asp"-->
    <!--#include file="../script/adovbs.inc"-->
    <%
    PageSize = 17
    bm=Trim(request.form("d3"))
    if bm="" or isnull(bm) then bm=-1
    bz=Trim(request.form("bz"))
    if bz="" or isnull(bz) then bz=-1
    Page =cint( Request("Page"))
    tj=Cstr(request("tj"))
    If Page <1 Then Page=1
      sql="select  * FROM rs_bm"
      set rs1=conn.execute(sql)
     
    if trim(bm)="-1" then
    bzsql="select * from rs_bz"
    else
    bzsql="select * from rs_bz where bmdh="+bm
    end if
    set rsbz=conn.execute(bzsql)
    if tj<>"" then
    if Trim(request.form("d3"))="-1" then
    if trim(bz)="-1" then
    sql="select sfzh,zdh,xm,xb,mz,bmdh,bzdh,cssj,cjgzsj,sfdh,zzmm,xldh,ysxldh,sxzy,byxx,bysj,zcdh,xgw,gwgzdj,gwgz,jngz,xygz,glgz FROM rs_jcxx ORDER by sjbh"
    else
    sql="select sfzh,zdh,xm,xb,mz,bmdh,bzdh,cssj,cjgzsj,sfdh,zzmm,xldh,ysxldh,sxzy,byxx,bysj,zcdh,xgw,gwgzdj,gwgz,jngz,xygz,glgz  FROM rs_jcxx where bzdh=" + bz +"ORDER by sjbh"
    end if
    else
    if trim(bz)="-1" then
    sql="select sfzh,zdh,xm,xb,mz,bmdh,bzdh,cssj,cjgzsj,sfdh,zzmm,xldh,ysxldh,sxzy,byxx,bysj,zcdh,xgw,gwgzdj,gwgz,jngz,xygz,glgz  FROM rs_jcxx where bmdh =" + bm +"ORDER by sjbh"
    else
    sql="select sfzh,zdh,xm,xb,mz,bmdh,bzdh,cssj,cjgzsj,sfdh,zzmm,xldh,ysxldh,sxzy,byxx,bysj,zcdh,xgw,gwgzdj,gwgz,jngz,xygz,glgz FROM rs_jcxx where bmdh =" + bm +" and bzdh="+bz+"ORDER by sjbh"
    end if
    end if
      Set rs = server.CreateObject("ADODB.RecordSet")
    rs.PageSize = PageSize
    rs.CursorLocation = adUseClient
    rs.open sql,conn
    If Not rs.EOF And Not rs.BOF then 
    rs.AbsolutePage = Page
    PageMax = rs.PageCount
    End If
    end if
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>人事信息</title>
    <script ID="clientEventHandlersJS" LANGUAGE="javascript">
    <!--
    function cx_onclick() {
    thisForm.Page.value=1
    }
    function first_onclick() {
    Page = parseInt(thisForm.Page.value)
    if(Page == 1)
    {
    return false
    }
    else
    {
    Page = 1
    thisForm.Page.value=1
    }
    }
    function prev_onclick() {
    Page = parseInt(thisForm.Page.value)
    if (Page <=1 )
    {
    alert("已经位于第一页了!")
    return false
    }
    else
    {
    Page--
    thisForm.Page.value=Page
    }
    }function next_onclick() { Page = parseInt(thisForm.Page.value)
    PageMax = parseInt(thisForm.PageMax.value)
    if (Page >= PageMax)
    {
    alert("已经位于最后一页了!")
    return false
    }
    else
    {
    Page++
    thisForm.Page.value=Page
    }
    }function last_onclick() {
    Page = parseInt(thisForm.Page.value)
    PageMax = parseInt(thisForm.PageMax.value)
    if (Page >= PageMax)
    {
    return false
    }
    else
    {
    thisForm.Page.value=PageMax
    }
    }function goto_onclick() {
    Page = parseInt(thisForm.Page.value)
    if (isNaN(Page))
    return false
    PageMax = parseInt(thisForm.PageMax.value)
    if (Page > PageMax)
    return false
    thisForm.Page.value=Page
    }//-->
    </script>
    <script Language="JavaScript">
    <!--
    function thisForm_Validator(theForm)
    {
      var checkOK = "0123456789-,";
      var checkStr = theForm.Page.value;
      var allValid = true;
      var decPoints = 0;
      var allNum = "";
      for (i = 0;  i < checkStr.length;  i++)
      {
        ch = checkStr.charAt(i);
        for (j = 0;  j < checkOK.length;  j++)
          if (ch == checkOK.charAt(j))
            break;
        if (j == checkOK.length)
        {
          allValid = false;
          break;
        }
        if (ch != ",")
          allNum += ch;
      }
      if (!allValid)
      {
        alert("在 page 域中,只能输入 数字 个字符。");
        theForm.Page.focus();
        return (false);
      }  var chkVal = allNum;
      var prsVal = parseInt(allNum);
      PageMax = parseInt(theForm.PageMax.value)
      if (chkVal != "" && !(prsVal >= "1" && prsVal <=  PageMax))
      {
        alert("请在 page 域中输入值 大于或等于 1 与 小于或等于"+ PageMax);
        theForm.Page.focus();
        return (false);
      }
      if (checkStr == "")
      {
        alert("page 域中输入值不为空");
        theForm.Page.focus();
        return (false);
      }
        return (true);
    }
    //-->
    </script>
    <base target="main">
    <script ID="clientEventHandlersVBS" LANGUAGE="vbscript">
    <!--
    Sub document_onkeydown
    'rs.open sql,conn, , adCmdTableEnd Sub
    -->
    </script>
    <meta name="Microsoft Theme" content="none, default">
    <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>
    </head>
    <body topmargin="0" leftmargin="0">
      <table border="0" cellspacing="0" cellpadding="0" width=227%>
         <td><script language="javascript" src="../JS/Toolbar/toolbar.js"></script><script language="javascript" src="../JS/Toolbar/cn/local.js"></script></td>
      </table>
    <table>
    <form method="POST" name="thisForm" action="jbda.asp" onsubmit="return thisForm_Validator(this)" target="main">
      <table width="1449" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="1422" colspan="3" valign="top">&nbsp; </td>
      </tr>
      <tr>
          <td width="1422" colspan="3"> 
          </td>
      </tr>
      <tr>
          <td width="150" valign="top"> 
         <table border="0" width="150" height="390" cellspacing="0" cellpadding="0" background="../images/0002.gif">
              <tr>
                <td width="150" height="44" valign="top">
                 </td>
            </tr>
            <tr>
              <td width="150" height="15" valign="middle" align="center">
                
                <p align="center"><font size="2">部门名称</font></td>
            </tr>
            <tr>
              <td width="150" height="1" valign="middle" align="right">
    <script LANGUAGE="javascript">
    <!--
    function refresh_bz(){
    var bmdh
    bmdh=document.thisForm.D3.options[document.thisForm.D3.selectedIndex].value;
    sl=document.thisForm.bz.length
    for(i=0;i<=sl;i++) thisForm.bz.remove(thisForm.bz.options[i]);
    oOption = document.createElement("OPTION");
    oOption.value="-1";
    oOption.text = "全部班组";
    document.thisForm.bz.add(oOption);
    <%
    sqlbz="select * from rs_bz where bmdh="+bmdh
    set rsbz=conn.execute(sqlbz)
    do while not rsbz.eof
    %>
    oOption = document.createElement("OPTION");
    oOption.value=<%=rsbz(0)%>;
    oOption.text = "<%=rsbz(1)%>";
    document.thisForm.bz.add(oOption);
    <%rsbz.movenext
    loop%>
    }
    //-->
    </script>
              
                <p align="center">
                  <font size="2">
                    <select size="1" name="D3" onchange="return refresh_bz()">
                      <option value="-1">全部部门</option>
                      <%do while not rs1.eof %>
                      <%if cint(bm)=rs1(0) and rs1(0)<>0 then%>
                      <option SELECTED value="<%=rs1(0)%>"><%=rs1(1)%></option>
                      <%else if rs1(0)<>0 then%>
                      <option value="<%=rs1(0)%>"><%=rs1(1)%></option>
                      <%end if%>
                      <%end if%>
                      <%rs1.movenext%>
                      <%loop%>
                    </select>
      </font>
    </p> 
                 
              </td> 
            </tr> 
            <tr> 
              <td width="100" height="1" valign="middle" align="center"> </td> 
            </tr> 
            <tr> 
              <td width="100" height="15" valign="middle" align="right"><font size="2">班组名称</font></td> 
            </tr> 
            <tr> 
              <td width="150" height="4" valign="middle" align="right">
                
                <p align="center"><font size="2"><select size="1" name="bz">
      <option value="-1">全部班组</option> 
    <%do while not rsbz.eof %>
    <%if cint(bz)=rsbz(0) and rsbz(0)<>0 then%>  
    <option SELECTED value="<%=rsbz(0)%>">
    <%=rsbz(1)%>
    </option>  
    <%else if rsbz(0)<>0 then%>  
    <option value="<%=rsbz(0)%>">
    <%=rsbz(1)%>
    </option>  
    <%end if%>  
    <%end if%>  
    <%rsbz.movenext%>  
    <%loop%>  
    </select></font></p>
                
              </td> 
            </tr> 
            <tr> 
              <td width="150" height="1" valign="middle" align="center"> 
               
                
               
              </td> 
            </tr> 
            <tr> 
              <td width="150" height="15" valign="middle" align="center"> 
                 
                <p align="center">  
                        <font size="2">  
                        <input type="submit" value="-查询-" name="cx" id="cx" LANGUAGE="javascript" onclick="return cx_onclick()" style="background-color: #00FF99; color: #800000; font-size: 12px; font-weight: bold"
    ></font></td> 
            </tr> 
            <tr> 
              <td width="150" height="122"></td> 
            </tr> 
          </table></td> 
          <td width="2" valign="top"> 
            
             
            
             
            <table border="0" width="1" height="390" cellspacing="0" cellpadding="0"> 
            <tr> 
              <td width="1" valign="top" bgcolor="#FFFFFF" height="100%" rowspan="3"> 
                
               <font size="2"><br></font> 
                
              </td> 
            </tr> 
          </table></td> 
          <td width="1291" valign="top"> 
            
             
            <%if tj<>"" then %>
            <%if not rs.eof then%>
            
             
            <table border="0" cellspacing="1" cellpadding="0" bgcolor="#808080" width="1266" height="1">  
       <tr>  
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="29"><p align="center"><font size="2">序号</font></p>                                                                                
                                                                                          
        </td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="69"><font size="2">姓名</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="51"><font size="2">性别</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="87"><font size="2">部门</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="83"><font size="2">班组</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="79"><font size="2">出生时间</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="93"><font size="2">参加工作时间</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="39"><font size="2">身份</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="64"><font size="2">政治面貌</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="57"><font size="2">最后学历</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="59"><font size="2">原始学历</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="59">
          <p align="center"><font size="2">所学专业</font></p>
        </td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="59"><font size="2">毕业学校</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="59"><font size="2">毕业时间</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="33">
          <p align="center"><font size="2">职称</font></p>
        </td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="33"><font size="2">岗位</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="33"><font size="2">岗级</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="59"><font size="2">岗位工资</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="59"><font size="2">技能工资</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="59"><font size="2">效益工资</font></td>                                                                                 
        <td nowrap align="center" bgcolor="#D8BFD8" height="14" width="59"><font size="2">年功工资</font></td>                                                                                 
         </tr>                                                           
         <%for i=1 to rs.pagesize
        if not rs.eof then%>                                                           
         <tr>
         <%j=i+(page - 1)*pagesize%>                                                           
         <td nowrap align="center" bgcolor="#FFFFE6" height="1" width="29"><font size="2"><%=j%></font></td>                                                                              
         <td nowrap align="center" bgcolor="#FFFFE6" height="1" width="69"><font size="2"><a href="zgda_detail.asp?name=<% = rs("sfzh")%>"><% = rs("xm")%></a></font></td>     
         <td width="51" nowrap align="center" bgcolor="#FFFFE6" height="1"><font size="2"><%=rs("xb")%></font></td>                                         
          <%                           
            bmsql = "select * from rs_bm where bmdh = " + cstr(rs("bmdh"))        
       set rsbm=conn.execute(bmsql)%> 
         <td nowrap align="center" bgcolor="#FFFFE6" height="1" width="87">
                  
                  <p align="center"><font size="2"><%=rsbm("bmmc")%></font></p>
                  
                </td>                               
          <%                           
            a = "select * from rs_bz where bzdh = " + cstr(rs("bzdh"))        
       set rs2=conn.execute(a)%>                                        
         <td nowrap align="center" bgcolor="#FFFFE6" height="1" width="83">
                  
                  <p align="center"><font size="2"><%=rs2(1)%></font></p>
                  
                </td>                                      
         <td nowrap align="center" bgcolor="#FFFFE6" height="1" width="79">
                  
                  <p align="center"><font size="2"><%=rs("cssj")%>&nbsp;</font></p>
                  
                </td>                                        
         <td nowrap align="center" bgcolor="#FFFFE6" height="1" width="93">
                  
                  <p align="center"><font size="2"><%=trim(rs("cjgzsj"))%>&nbsp;</font></p>
                </td>                                        
         <% sfsql="select * from rs_sf where sfdh="+cstr(rs("sfdh"))
         set rssf=conn.execute(sfsql)%>
         <td nowrap align="center" bgcolor="#FFFFE6" height="1" width="39">
                  
                  <p align="center"><font size="2"><%=rssf("sfmc")%>&nbsp;</font></p>
                </td>                                        
         <td nowrap align="center" bgcolor="#FFFFE6" height="1" width="64">
                  <p align="center"><font size="2"><%=rs("zzmm")%>&nbsp;</font></p>
                  
                </td>
                <% xlsql="select * from rs_xl where xldh=" + cstr(rs("xldh"))
                 set rsxl=conn.execute(xlsql)%>                                        
         <td nowrap align="center" bgcolor="#FFFFE6" height="1" width="57">
                  <p align="center"><font size="2"><%=rsxl("xlmc")%>&nbsp;</font></p>
                  
                </td>                             
                <% ysxlsql="select * from rs_xl where xldh=" + cstr(rs("ysxldh"))
                 set rsysxl=conn.execute(ysxlsql)%>           
         <td nowrap align="center" bgcolor="#FFFFE6" height="1" width="59">
                  <p align="center"><font size="2"><%=rsysxl("xlmc")%>&nbsp;</font></p>
                  
                </td>                                        
         <td nowrap align="center" bgcolor="#FFFFE6" height="1">
                  <p align="center"><font size="2"><%=rs("sxzy")%>&nbsp;</font></p>
                  
                </td>                                        
         <td nowrap align="center" bgcolor="#FFFFE6" height="1">
                  <p align="center"><font size="2"><%=rs("byxx")%>&nbsp;</font></p>
                  
                </td>                                        
         <td nowrap align="center" bgcolor="#FFFFE6" height="1">
                  <p align="center"><font size="2"><%=rs("bysj")%>&nbsp;</font></p>
                  
                </td>
                <% zcsql="select * from rs_zc where zcdh="+ cstr(rs("zcdh"))
                 set rszc=conn.execute(zcsql)%>                                        
         <td nowrap align="center" bgcolor="#FFFFE6" height="1">
                  <p align="center"><font size="2"><%=rszc("zcmc")%>&nbsp;</font></p>
                  
                </td>                                        
         <td nowrap align="center" bgcolor="#FFFFE6" height="1">
                  <p align="center"><font size="2"><%=rs("xgw")%>&nbsp;</font></p>
                  
                </td>                                        
         <td nowrap align="center" bgcolor="#FFFFE6" height="1" width="33">
                  
                  <p align="left"><font size="2"><%=rs("gwgzdj")%>&nbsp;</font></p>
                  
                </td>                                        
         <td nowrap align="center" bgcolor="#FFFFE6" height="1" width="59">
                  <p align="left"><font size="2"><%=rs("gwgz")%>&nbsp;</font></p>
                  
                </td>                                        
         <td nowrap align="center" bgcolor="#FFFFE6" height="1" width="59">
                  <p align="left"><font size="2"><%=rs("jngz")%>&nbsp;</font></p>
                  
                </td>                                        
         <td nowrap align="center" bgcolor="#FFFFE6" height="1" width="59">
                  <p align="left"><font size="2"><%=rs("xygz")%>&nbsp;</font></p>
                  
                </td>                                        
         <td nowrap align="center" bgcolor="#FFFFE6" height="1" width="59">
                  <p align="left"><font size="2"><%=rs("glgz")%>&nbsp;</font></p>
                  
                </td>                                        
      </tr>                                
     <%rs.movenext                                
      else                                
      exit for                                
      end if                                
       next                                
       rs.close() %>                                
    </table>                                                                     
                                                                            
    <%end if%>                                                                       
    <%end if%>                                                                       
                                                                              
          <table border="0" cellspacing="0" width="100%" cellpadding="0" height="22">                                         
            <tr>                                         
               <td width="72%">                                         
                                                         
                <font size="2">                                        
             <input type="hidden" id="PageMax" name="PageMax" value="<%Response.Write PageMax%>">                                       
              <input type="hidden" name="tj" value="1">                                       
    <% If Page <> 1 Then %>                                       
            <input type="submit" value="第一页" id="first" name="first" LANGUAGE="javascript" onclick="return first_onclick()">                                       
             <%End If%>                                                                                                                                                                                                                                                                                          
    <% If Page <> 1  and pageMax>1 Then %>                                                                                                                                                                                                                                                                                          
             <input type="submit" value="上一页" id="prev" name="prev" LANGUAGE="javascript" onclick="return prev_onclick()">                                                                                                                                                                                                                                                                                          
               <%End If%>                                                                                                                                                                                                                                                                                          
    <% If cint(Page) <> cint(PageMax) and  cint(PageMax) >1  then %>                                                                                                                                                                                                                                                                                          
        <input type="submit" value="下一页" id="next" name="next" LANGUAGE="javascript" onclick="return next_onclick()">                                                                                                                                                                                                                                                                                          
         <%End If%>                                                                                                                                                                                                                                                                                          
         <% If cint(Page) <> cint(PageMax) and  cint(PageMax) >1  then %>                                                                                                                                                                                                                                                                                          
              <input type="submit" value="最后一页" id="last" name="last" LANGUAGE="javascript" onclick="return last_onclick()">                                                                                                                                                                                                                                                                                          
         <%End If%>                                                                                                                                                                                                                                                                                          
    <% If cint(Page) = cint(PageMax)  And Page= 1 or bm="" then %>                                                                                                                                                                                                                                                                                          
    <%else%>                                                                                                                                                                                                                                                                                          
           <% If  cint(PageMax) >0 then %>                                                                                                                                                                                                                                                                                          
                <input type="submit" value="输入页数:" id="goto" name="goto" LANGUAGE="javascript" onclick="return goto_onclick()" onkeydown="return goto_onkeydown()" oncellchange="return goto_oncellchange()">                                                                                                                                                                                                                                                                                          
        <%End If%>                                                                                                                                                                                                                                                                                          
         <%End If%>                                                                                                                                                                                                                                                                                          
                <% If cint(Page) = cint(PageMax)  And Page= 1 or bm="" then %>                                                                                                                                                                                                                                                                                          
              <%else%>                                                                                                                                                                                                                                                                                          
                    <% If  cint(PageMax) >0 then %>                                                                                                                                                                                                                                                                                         
                        <input type="text" id="Page" name="Page" value="<%Response.Write Page%>" size="5">页                                                                                                                                                                                                                                                                                           
                    <%End If%>                                                                                                                                                                                                                                                                               
                <%End If%>                                                                                                                                                                                                                                                                                          
                </font>                                                                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                               
                <td width="13%" valign="middle" align="right">                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                          
                <%If pagemax>0 then%>                                                                                                                                                                                                                                                                  
                <font size="2" align="right" color="#FF0000">页数:<%=Page%>/<%=PageMax%></font>                                                                                                                                                                                                                                                                   
                <%End if%>                                                                                                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                             
               </td>                                                                                                                                                                                                                                                                                                                   
                <td width="10%" valign="middle" align="right"></td>                                                                                                                                                                                                                                                                                                               
      </tr>                                                                                                                                                                                                                                                                                                               
          </table></td>                                                                                                                                                                                                                                                                                                                                                                                
      </tr>                                                                                                                                                                                                                                                                                                                                                                                
    </table>                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                                                                                    
     </form>                                                                                                                                                                                                                                                                                                                                                                                  
     <%                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
    rs1.close()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
    conn.close()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
    %>                                                                                                                                                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                                                                                                               
    </body>                                                                                                                                                                                                                                                                                                                                                                                
    OK!!!!
      

  4.   

    you are still trying to use something from yet-to run client-side script on the server side, they are not relatedif you want to use the selected value in D3 to refresh the content of bz list, add a "server-side" variable "bmdh" at the top and try to get its value, like
    <%
     dim bmdh
     bmdh = Request("D3")
    %>
      

  5.   

    Thank you very much,karma!!!
    I see!!!!