Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Ajax和文本框更改事件_Javascript_Ajax_Asp Classic - Fatal编程技术网

Javascript Ajax和文本框更改事件

Javascript Ajax和文本框更改事件,javascript,ajax,asp-classic,Javascript,Ajax,Asp Classic,我正在准备一份报名表。表单中有两个文本框。在一个文本框中,当我键入关键字时,将打开一个DIV,并显示具有customerid和customername的客户列表 <form name="form1" action=""> customerid : <input type=text id="cusid" /> customername: <input type="text" id="custnm" onkeyup="showHint(this.value);" /&

我正在准备一份报名表。表单中有两个文本框。在一个文本框中,当我键入关键字时,将打开一个DIV,并显示具有customerid和customername的客户列表

<form name="form1" action=""> 
customerid : <input type=text id="cusid" />
customername: <input type="text" id="custnm" onkeyup="showHint(this.value);" />
</form>


<div id="txtHint" style="width:250; background-color:cyan; display:none; ">

</div>
这是getemp.asp文件

sernm=request("q")
response.Write "<table>"
ks.open "select customer,customerid from customer where customername like '"&sernm&"%'",conn
if not ks.eof then
while not ks.eof
    vid=ks(1):if isnull(vid) or trim(vid)="" then vid=0
    acname=ks(0)
    'response.Write empnm &"&nbsp;"& ad1 &"&nbsp;"& ad2 &"&nbsp;"& ad3 &"<br>"  
    response.Write "<tr>"
    %>
    <td><a href="" onclick="return CloseWind('12');" ><%=vid%></a></td>
    <%
    response.Write "<td>"&acname&"</td>"
    response.Write "</tr>"

    ks.movenext
wend
end if
ks.close
response.Write "<table>"
sernm=请求(“q”)
响应。写入“”
ks.open“选择客户,客户ID来自客户,客户名称如“&&sernm&“%”,conn
如果不是ks.eof,那么
而不是ks.eof
vid=ks(1):如果isnull(vid)或trim(vid)=“”,则vid=0
acname=ks(0)
'response.Write empnm&'&ad1&'&ad2&'&ad3&'
' 响应。写入“” %>
什么不起作用?当用户单击生成的列表中的链接时,我无法在CUSID文本框中获取customerid。您还没有编写任何代码来实现这一点…document.forms['form1'].elements[CUSID]。value=VID;我已尝试在链接的单击事件中使用此代码。但无法获得所需的结果。您尚未在问题中添加该代码!还共享解析后的html而不是
.asp
文件
JavaScript
可用于操作
DOM
,因此您需要共享
DOM
结构。。。
sernm=request("q")
response.Write "<table>"
ks.open "select customer,customerid from customer where customername like '"&sernm&"%'",conn
if not ks.eof then
while not ks.eof
    vid=ks(1):if isnull(vid) or trim(vid)="" then vid=0
    acname=ks(0)
    'response.Write empnm &"&nbsp;"& ad1 &"&nbsp;"& ad2 &"&nbsp;"& ad3 &"<br>"  
    response.Write "<tr>"
    %>
    <td><a href="" onclick="return CloseWind('12');" ><%=vid%></a></td>
    <%
    response.Write "<td>"&acname&"</td>"
    response.Write "</tr>"

    ks.movenext
wend
end if
ks.close
response.Write "<table>"
<script language="javascript">
function CloseWind(VID)
{
    document.forms['form1'].elements[CUSID].value=VID;
    return false;
}   
</script>