正在学习ASP + javascript + SQL
<input onBlur="login_onblur()" name="yhid" type="text" id="textfield2" size="30" />
<%
function login_onblur()
{
var sql
sql = "select A.User_code,A.User_name,A.User_PSD,CONVERT(varchar(100), P.Begin_date, 23) as Begin_date, CONVERT(varchar(100), P.END_date, 23) as END_date,Q.vendorCode,Q.cvenname FROM vendor_username A LEFT JOIN vendor_JiaoFei P ON A.vendorid=P.vendorid LEFT JOIN ba_vendor_all Q ON A.vendorid=Q.vendorid where A.if_active=1 and getDATE()>=P.Begin_date and getDATE()<=P.END_date and A.User_Code="
Response.Write(sql)
Response.End
}
%>
运行结果是:无任何反应,也无任何出错提示。
------解决方案--------------------
这要用ajax来实现
function getPage(url){
var xhr=window.ActiveXObject? new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
xhr.open('get',url,false);
xhr.send(null);
return xhr.responseText
}
function login_onblur()
{
var content= getPage(login_onblur.asp)
alert(content)
}
独立个asp页面 login_onblur.asp
var sql
sql = "select A.User_code,A.User_name,A.User_PSD,CONVERT(varchar(100), P.Begin_date, 23) as Begin_date, CONVERT(varchar(100), P.END_date, 23) as END_date,Q.vendorCode,Q.cvenname FROM vendor_username A LEFT JOIN vendor_JiaoFei P ON A.vendorid=P.vendorid LEFT JOIN ba_vendor_all Q ON A.vendorid=Q.vendorid where A.if_active=1 and getDATE()>=P.Begin_date and getDATE()<=P.END_date and A.User_Code="
Response.Write(sql)