求ajax+jsp用户注册代码

来源:百度知道 编辑:UC知道 时间:2024/06/28 02:29:51
求jsp注册页面代码
用ajax实现注册信息判断,即时的判断

你都要判断什么?有无重复用户名之类的?
在用户名的input中写一个onkeyup的事件。在事件中调用js写好的
-----------------------------
var xmlhttp;
function createXMLHTTP() {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch(oc) {
xmlhttp = null;
}
}
if(!xmlhttp && typeof XMLHttpRequest !="undefined" ) {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}

function vote(fid,product) {
xmlhttp = createXMLHTTP();
xmlhttp.open("GET","requesturl",false);
//回调函数
xmlhttp.onreadystatechange = function updatePage() {
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
if(xmlhttp.responseText.length !== 0) {
//你的判断完的操作