<input name="Cust_ID" type="text"  onclick="javascript:test()"><a  id="tt" href="ResultList2.jsp?eval_code=01&Cust_ID="> 查询 </a><script>
function test()
{

document.all.tt.href= "http://www.csdn.net";
}
</script>
你把 document.all.tt.href= "http://www.csdn.net";它换成自己的也面就好了

解决方案 »

  1.   

    上面的方法试了一下,不行啊!
    我不明白  Cust_ID变量 如何得到  Input 中输入的值的另外,"document.all.tt.href= "http://www.csdn.net";它换成自己的也面就好了"--------换成什么页面,我指定的页面有了呀----“http://./ResultList2.jsp?eval_code=01&Cust_ID=    ”,现在就是要
    Cust_ID变量 得到  input 中输入的值。
      

  2.   

    试试下面的代码:
     
    <a href=# onClick="geturl();"> 查询 </a>
    <script language=JavaScript>
    <!--
       function geturl()
    {
      var str="document.all.location=ResultList2.jsp?val_code=01&Cust_ID="+document.all.Cust_ID.value;
      eval(str);
      }
    //-->
    </script>
      

  3.   

    <input name="Cust_ID" type="text" value="" size="10" maxlength="10" >
    <a href="ResultList2.jsp?eval_code=01&Cust_ID=" onclick="this.href+=Cust_ID.value">单客户</a>
    ------------------------------
    http://192.168.199.200/crm/admin/ResultList2.jsp?eval_code=01&Cust_ID=undefined--------
    Cust_ID=undefined    -----  怎么回事?
      

  4.   

    改成:
    <a href="ResultList2.jsp?eval_code=01&Cust_ID=" onclick="this.href+=document.all.Cust_ID.value">单客户</a>
      

  5.   

    document.all.Cust_ID.value我刚才已经试过了,还是不行。
    name="Cust_ID" 和 name=Cust_ID    有没有区别??
      

  6.   

    你用name=Cust_ID   试试吧,我是这样的,没有你那个错误啊?
    我要回去了。
      

  7.   

    我都试不过了,还是不行。我想问一问他们有区别吗?
    ---------------------------------
    源码张贴:
    -------------------------------------
    <meta http-equiv="Content-Type" content="text/html; charset=GBK">
    <%@ include file="header.jsp" %>
    <jsp:useBean id="codeConver" scope="page" class="crm.evaluate.beans.CodeConver"/>
    <jsp:useBean id="ResultList1" scope="page" class="crm.evaluate.admin.ResultList1"/>
    <jsp:setProperty name="ResultList1" property="*"/> 
    <jsp:setProperty name="ResultList1" property="userid" value="<%= userid %>"/>
    <%
      if (ResultList1.isValid()) {
        boolean hasData = ResultList1.select();
        
        if(hasData)
         System.out.println("Eval_Desc:" + codeConver.getISO(ResultList1.getEval_Desc()));
        int cpage = ResultList1.getPage();
    %>
    <br>
    <table width="95%" border="0" cellspacing="0" cellpadding="1">
      <tr>
        <td colspan="2" align="center"> <table cellspacing=1 cellpadding=2 width=100%>
            <tr bgcolor="#CCCCCC" height=16> 
              <td width="144"><div align="center"><strong><font face="楷体_GB2312">评估项描述<br>
                  </font></strong></div></td>
              <td colspan="2"><div align="center"><strong><font face="楷体_GB2312">查询功能</font></strong></div></td>
              <td align="center"><div align="center"><strong><font face="楷体_GB2312"> 
                  计算功能</font></strong></div></td>
            </tr>
            <% if (hasData && ResultList1.next()) { do { %>
            <tr bgcolor="<jsp:getProperty name="ResultList1" property="bgcolor"/>"> 
              <td height="22" align="center"><font face="楷体_GB2312"> 
                <% if(ResultList1.getEval_Desc() == null || (ResultList1.getEval_Desc()).equals(""))
             out.println(" ");
            else{
               out.println(codeConver.getISO(ResultList1.getEval_Desc()));
    }
                %>
                </font></td>
              <td width="186" align="center"><font face="仿宋_GB2312"> <a href="ResultList2.jsp?eval_code=<jsp:getProperty name="ResultList1" property="eval_code"/>&Cust_ID=0">所有客户</a></font></td>
              <td width="185" align="center"><div align="center"><font face="仿宋_GB2312"> 
                    <input name="Cust_ID" type="text" value="" size="10" maxlength="10" >
                    <a href="ResultList2.jsp?eval_code=<jsp:getProperty name="ResultList1" property="eval_code"/>&Cust_ID=" onclick="this.href+=document.all.Cust_ID.value">单客户</a></font></div></td>
              <td width="191" align="center"> <div align="center"><font face="楷体_GB2312"><a href="Count_Result.jsp?eval_code=<jsp:getProperty name="ResultList1" property="eval_code"/>">所有客户</a></font></div></td>
            </tr>
            <% } while (ResultList1.next()); } %>
            <tr bgcolor="#CCCCCC" height=16> 
              <td colspan=4 align=right> <font face="楷体_GB2312"> 
                <% if (ResultList1.isFirstPage()) { %>
                上页 
                <% } else { %>
                <a href="ResultList1.jsp?page=<%= cpage-1 %>">上页</a> 
                <% } %>
                &nbsp; 
                <% if (ResultList1.isLastPage()) { %>
                下页 
                <% } else { %>
                <a href="ResultList1.jsp?page=<%= cpage+1 %>">下页</a></font> 
                <% } %>
              </td>
            </tr>
          </table></td>
      </tr>
    </table>
    <%
      } else {
        out.println("<p align=center>" + codeConver.getISO("错误,参数传递错误!") + "<a href=\"javascript:history.back()\">" + codeConver.getISO("返回") + "</a></p>");
      }
    %>
    <%@ include file="footer.jsp" %>
      

  8.   

    累了,短短说一下吧 行的:

       <a href="ResultList2.jsp?eval_code=01&Cust_ID=  ??? "> 查询 /a>
    改成
      <a href="ResultList2.jsp?eval_code=01&Cust_ID=" id="nameA"> 查询</a>接着:
    function appendUrl(){
      document.all.nameA.href+=(document.all.Cust_ID.value); 
       
    }
      

  9.   

    不小心提交了,算了吧 您应该能看明白的。你也可以用alert(document.all.nameA.href+=(document.all.Cust_ID.value))
    先看看嘛。行的话就请给分吧(这可是我刚为您想出来的,我测试过行的)
      

  10.   

    楼上的:
    我按你说的方法测试,还是不行。我把超链的代码改为如下,测试也不行。<a href="ResultList2.jsp?eval_code=01&Cust_ID=" id="nameA"><a href="javascript:appendUrl()">单客户</a></a>
      

  11.   

    <input name="Cust_ID" type="text" value="" size="10" maxlength="10">对于name,我不熟悉,不知道怎么用。你可以把name改成id,就可以通过
    document.all.Cust_ID.value的值了
    然后
    <a href="ResultList2.jsp?eval_code=01&Cust_ID="+document.all.Cust_ID.value><a>
    就好了!
      

  12.   

    楼上的:
    name="Cust_ID" ; name=Cust_ID ;id="Cust_ID" ;id=Cust_ID四种情况都试过了。还是不行,是不是我在别的地方出了问题?上面有我的源代码。谢谢了。
      

  13.   

    倒~~ 难道 jsp 里就不能直接取得 <input typt=text> 里的值?!!
    还一定要用 url 来传啊?!?!反正我没学过 jsp 不知道. 在 asp. php 里都是可以的. 只要
    把input 放在 form 里. 提交时提交到自己(当前页), 就可以直接引用
    <input> 里的值了啊??
      

  14.   

    昨天我没睡好:不给分我(我是第一次回答人家的问题的,不要打击我的积极性嘛)。好吧 我给你写测试的代码(我不懂jsp,但是javascript凑合吧)。<html>
    <head>
    <title>在同一个页面里,如何使的 input 输入的 value 在下面的 url 中得到?</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <script language="JavaScript">
    function appendUrl(){
    var str="ResultList2.jsp?eval_code=01&Cust_ID=";
    str+=document.all.Cust_ID.value;
       document.all.nameA.href=str; 
       alert(document.all.nameA.href);
       return true;
    }
    </script>
    </head><body bgcolor="#FFFFFF" text="#000000">
    <input type="text" name="Cust_ID" value="123">
    <a href="" id="nameA" onMouseOver="javascript:appendUrl()"> 查询</a>
    </body>
    </html>
      

  15.   

    下面的代码可以
    <input name="Cust_ID" type="text" value="" size="10" maxlength="10">
    ……
    <a href="" onclick="javascript:this.href='ResultList2.jsp?eval_code=01&Cust_ID='+document.all.Cust_ID.value" > 查询 </a>name="Cust_ID" 和 name=Cust_ID没有区别,标准的写法为前面那种另外,对于jsp的问题,你可以常去jsp区看一看 :-)
      

  16.   

    if (hasData && ResultList1.next()) { do { if(ResultList1.getEval_Desc() == null || (ResultList1.getEval_Desc()).equals(""))
             out.println(" ");
            else{
               out.println(codeConver.getISO(ResultList1.getEval_Desc()));
    }
                 <a href="ResultList2.jsp?eval_code=<jsp:getProperty name="ResultList1" property="eval_code"/>&Cust_ID=0">所有客户</a>
                    <input name="Cust_ID" type="text" value="" size="10" maxlength="10" >
                    <a href="ResultList2.jsp?eval_code=<jsp:getProperty name="ResultList1" property="eval_code"/>&Cust_ID=" onclick="this.href+=document.all.Cust_ID.value">单客户</a>
    <a href="Count_Result.jsp?eval_code=<jsp:getProperty name="ResultList1" property="eval_code"/>">所有客户</a>
    } while (ResultList1.next()); }
    --------------------------------------------
    do...while...循环
    然而
    input name 只有一个名字,错误就在此处。