在DIV里我用了表單form 的post向數(shù)據(jù)庫提交數(shù)據(jù)后,服務(wù)器反饋回來一個(gè)xml文件,我想判斷我在文本框里輸入的值和我數(shù)據(jù)庫里面的值來個(gè)判斷,例如:判斷輸入的值是否在數(shù)據(jù)庫里,顯示出來。那我該如何判斷呢?????
?
div中的代碼<form method="post" action="findit.php">??????????????? <div data-role="fieldcontain">??????????????????? ?<fieldset data-role="controlgroup">??????????????????????? ?<label for="textinput2">??????????????????????? ?</label>??????????????????????? ?<input placeholder="" value="" type="text" />??????????????????? ?</fieldset>??????????????? </div>??????????????? <a href="#page2"><input type="submit" value="開找" data-mini="true" />??????????????????? ??????????????? </a>??????????? ?</form>
?
?
<script type="text/javascript"> ??????????? function createXmlHttpReq() { ??????????????? if(window.XMLHttpRequest) { ??????????????????? xmlHttpReq = new XMLHttpRequest(); ???????????????? ??????????????? } else { ???????????????? ??????????????????? xmlHttpReq = new ActiveXObject("MSXML2.XMLHTTP"); ???????????????? ??????????????? } ??????????????? return xmlHttpReq; ???????????? ??????????? } ??????????? ??????????? function processResponse() ???{ ??????????????? if(xmlHttpReq.readyState == 4) ????{ ??????????????????? if(xmlHttpReq.status == 200) ?????{ ???????????????????????????????????? /*var res = xmlHttpReq.responseText; ????????????????????????????????????? document.getElementById("message").innerHTML=res;???? */?????????? ??????????????????????? var msg = xmlHttpReq.responseXML;???????? ??????? ??????alert(xmlHttpReq.responseText);???????????????????? ????? } ???????????????? } ???????????? ???????????? } ??????????? ??????????? function sendRequest(url) { ???????????????? ??????????????? createXmlHttpReq(); ??????????????? xmlHttpReq.open("get",url,true);?????????????? ??????????????? xmlHttpReq.onreadystatechange=processResponse; ??????????????? xmlHttpReq.send(null); ???????????????? ??????????? } ????????????????? ???????????? ??????????? function doSubmit() { ???????????????? var name = document.getElementById("lgname").value;????? var pwd = document.getElementById("lgpwd").value;??????????????? var url =? 'login_chk.php?name='+name+'&pwd='+ pwd;????sendRequest(url); ??????????? } ???????? ???????? ??????? </script>
javaScript對form的操作
動(dòng)漫人物
2018-12-07 04:26:05