<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";它换成自己的也面就好了
function test()
{
document.all.tt.href= "http://www.csdn.net";
}
</script>
你把 document.all.tt.href= "http://www.csdn.net";它换成自己的也面就好了
我不明白 Cust_ID变量 如何得到 Input 中输入的值的另外,"document.all.tt.href= "http://www.csdn.net";它换成自己的也面就好了"--------换成什么页面,我指定的页面有了呀----“http://./ResultList2.jsp?eval_code=01&Cust_ID= ”,现在就是要
Cust_ID变量 得到 input 中输入的值。
<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>
<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 ----- 怎么回事?
<a href="ResultList2.jsp?eval_code=01&Cust_ID=" onclick="this.href+=document.all.Cust_ID.value">单客户</a>
name="Cust_ID" 和 name=Cust_ID 有没有区别??
我要回去了。
---------------------------------
源码张贴:
-------------------------------------
<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>
<% } %>
<% 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" %>
把
<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);
}
先看看嘛。行的话就请给分吧(这可是我刚为您想出来的,我测试过行的)
我按你说的方法测试,还是不行。我把超链的代码改为如下,测试也不行。<a href="ResultList2.jsp?eval_code=01&Cust_ID=" id="nameA"><a href="javascript:appendUrl()">单客户</a></a>
document.all.Cust_ID.value的值了
然后
<a href="ResultList2.jsp?eval_code=01&Cust_ID="+document.all.Cust_ID.value><a>
就好了!
name="Cust_ID" ; name=Cust_ID ;id="Cust_ID" ;id=Cust_ID四种情况都试过了。还是不行,是不是我在别的地方出了问题?上面有我的源代码。谢谢了。
还一定要用 url 来传啊?!?!反正我没学过 jsp 不知道. 在 asp. php 里都是可以的. 只要
把input 放在 form 里. 提交时提交到自己(当前页), 就可以直接引用
<input> 里的值了啊??
<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>
<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区看一看 :-)
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 只有一个名字,错误就在此处。