问题描述
js没什么基础,所以最好能给源码
解决方案
解决方案二:
baiduandgoogle
解决方案三:
搜不到才问的
解决方案四:
JS和数据库交互<scriptlanguage="JavaScript">functionchenckUserName(){varUserName=document.all.UserId.value;varxmlhttp;try{xmlhttp=newActiveXObject('Msxml2.XMLHTTP');}catch(e){try{xmlhttp=newActiveXObject('Microsoft.XMLHTTP');}catch(e){try{xmlhttp=newXMLHttpRequest();}catch(e){}}}xmlhttp.open("get","check1.asp?userid="+escape(UserName));xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){if(xmlhttp.responseText=="0"){document.all.spntishi.innerHTML="";document.all.spntishi.innerHTML="<divstyle='background-color:#FF6666'>Sorry,theuseraccounthasbeenregisted</div>";document.ADDUser.UserId.focus();//returnfalse;//alert("theUserNameinputtedexists!");}elseif(xmlhttp.responseText=="1"){document.all.spntishi.innerHTML="";document.all.spntishi.innerHTML="<divstyle='background-color:#00FF66'>congratulate!</div>";}elseif(xmlhttp.responseText=="2"){document.all.spntishi.innerHTML="";document.all.spntishi.innerHTML="<divstyle='background-color:#FF6666'>Sorry,theusernameempty</div>";document.ADDUser.UserId.focus();}}else{alert("neterror");}}}xmlhttp.send(null);}
自动提交请使用setTimeout
解决方案五:
顶一下学习咯