<form id="form1" name="form1" action="reg_insert.php" method="post">
<table border="0" cellspacing="0" cellpadding="0" width="1000px">
<tr><td><table border="0" cellspacing="0" cellpadding="0">
<tr>
//用户名这一条死活没反映
<td width="400px">用户名:</td>
<td width="170px"><input type="text" id="username"/></td>
<td width="400px"><p id="checkusername"></p></td>
</tr>
//这一条员工编号却可以,哪里写错了
<tr>
<td><label>请输入员工编号:</label></td>
<td><input type="text" id="keyword" /></td>
<td><p id="searchResult"></p></td></tr>
<tr>
<td colspan="2"><span style="font-size:11px; color:#999">(必填,3-16字符长度,支持字母、数字及_)</span></td>
</tr>document.getElementById("username").onblur = function() {
var un=username.value;
if(un==""){
document.getElementById("checkusername").innerHTML = "写东西啊!";
}else if(un.length<4){
document.getElementById("checkusername").innerHTML = "用户名不能少于4位";
}else
{
document.getElementById("checkusername").innerHTML = "123"; }
}
//这里的get传递页面没有问题。不用担心
document.getElementById("keyword").onblur = function() {
var request = new XMLHttpRequest();
request.open("GET", "server.php?number=" + document.getElementById("keyword").value);
request.send();
request.onreadystatechange = function() {
if (request.readyState===4) {
if (request.status===200) {
document.getElementById("searchResult").innerHTML = request.responseText;
} else {
alert("发生错误:" + request.status);
}
}
}
}
添加回答
举报
0/150
提交
取消