您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

ajax异步请求鼠标离开输入文本框的问题

2026/2/2 10:19:37发布19次查看
<%@ page language="java" contenttype="text/html; charset=utf-8" pageencoding="utf-8"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>ajax1</title> <script> //创建浏览器对象 function createxhr(){ //判定浏览器类型处理第一种方法 /* var xhr; var str=window.navigator.useragent; if(str.indexof('msie')>0){ xhr=new activexobject('microsoft.xmlhttp'); }else{ xhr=new xmlhttprequest(); } return xhr; */ try{ return new activexobject('microsoft.xmlhttp'); }catch(e){ } try{ return new xmlhttprequest(); }catch(e){ } }; //获得id属性值简单分装方法 function $(id){ return document.getelementbyid(id); }; window.onload=function(){ $('username').onblur=function(){ var username=$('username').value; var xhr=createxhr(); xhr.onreadystatechange=function(){ if(xhr.readystate==4&&xhr.status==200){ }; } xhr.open("get","/ajax2?username="+username); xhr.send(null); } }; </script> </head> <body> 用户名:<input type="text" name="username" id="username"/> </body> </html>
以上就是ajax异步请求鼠标离开输入文本框的问题 的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product