济南市户籍咨询电话:谁知道javascript的变量在asp中怎么使用啊?谢谢!

来源:百度文库 编辑:中科新闻网 时间:2024/05/03 01:32:32
我想实现的功能是 在输入完name=xingming这个表单,当失去焦点的时候,就会自动查
数据库,看有没有这个人名,所以这个表单还没有提交,怎么实现呢。

怎么提取表单的值(注意是没有提交的表单是不可以用request("xingming")来提取的)
<script language="javascript">
function jiaodian()
{
sql="<%call sh()%>
alert(sql);
}
</script>

<%
sub sh()
set rs1=server.createobject("adodb.recordset")
sql1="select * from zuozhe where xingming='提取表单的值'"
rs1.open sql1,conn,1,3
if rs1.eof then
Response.Write"没有找到需要的作者"
end if
end sub
%>

请问怎么把“提取表单的值”换成没有提交的表单的值
比如要提取表单是
<form name="myform">
<input name=xingming type=text id=xingming size=14 onblur=jiaodian()>
</form>
注意是没有提交的表单

这个程序是正确的,就是不知道在
sql1="select * from zuozhe where xingming='提取表单的值'"
怎么提取表单myform.xingming.value的值。比如在javascript中用myform.xingming.value
可以提取,但是在asp查数据库就不可以用了,还有谁知道javascript的变量在asp中怎么使
用啊,谢谢非常感谢!

<form name="myform">
<input name=xingming type=text id=xingming size=14 onblur=jiaodian()>
</form>
<script language="JavaScript" type="text/javascript">
function jiaodian()
{
url="ishefa.asp?xingming=" + document.myform.xingming.value;//调用页面
try
{
DataLoad.src = url;
}
catch(e)
{
return false;
}
}
</script>
<script id="DataLoad" language="JavaScript" type="text/javascript" defer></script>

ishefa.asp页面内容
<%
'定义conn....
xingming=request("xingming")
sql=="select * from zuozhe where xingming='& xingming &'"
set rs=conn.execute(sql)
if rs.eof then
Response.Write("alert('没有此用户名可以使用');")
else
Response.Write("alert('已经有此用户名,请...');")
end if
%>

你所说的没有提交表单,如果是指在文本框中输入名字后不提交表单,真接在数据库里找有没有记录,那
xmlhttp 是解决你的问题的最好方法

你在jiaodian函数内使用xmlhttp无刷新查询数据库。