標籤:style blog http java color os
1 // JavaScript Document 2 function chkname(form){ 3 var user = form.user.value; 4 if(user == ‘‘){ 5 alert(‘請輸入使用者名稱‘); 6 form.user.focus(); 7 return false; 8 }else{ 9 var url = "foundpwd.php?user="+user;10 xmlhttp.open("GET",url,true);11 xmlhttp.onreadystatechange = function(){12 if(xmlhttp.readyState == 4){13 var msg = xmlhttp.responseText;14 if(msg == ‘0‘){15 alert(‘沒有該使用者,請重新尋找!‘);16 form.user.select();17 return false;18 }else{19 document.getElementById(‘first‘).style.display = ‘none‘;20 document.getElementById(‘second‘).style.display = ‘‘;21 document.getElementById(‘question‘).innerHTML = msg;22 }23 }24 }25 xmlhttp.send(null);26 }27 }28 function chkanswer(form) {29 var user = document.getElementById(‘user‘).value;30 var answer = form.answer.value;31 if(answer == ‘‘){32 alert(‘請輸入提示問題‘);33 form.answer.focus();34 return false;35 }else{36 var url = "foundpwd.php?user="+user+"&answer="+answer;37 xmlhttp.open("GET",url,true);38 xmlhttp.onreadystatechange = function(){39 if(xmlhttp.readyState == 4){40 var msg = xmlhttp.responseText;41 if(msg == ‘0‘){42 alert(‘問題回答錯誤‘);43 form.answer.select();44 return false;45 }else{46 document.getElementById(‘second‘).style.display = ‘none‘;47 document.getElementById(‘third‘).style.display = ‘‘;48 }49 }50 }51 xmlhttp.send(null);52 }53 }54 function chkpwd(form){55 var user = document.getElementById(‘user‘).value;56 var pwd1 = form.pwd1.value;57 var pwd2 = form.pwd2.value;58 if(pwd1 == ‘‘){59 alert(‘請輸入密碼‘);60 form.pwd1.focus();61 return false;62 }63 if(pwd1.length < 6){64 alert(‘密碼輸入錯誤‘);65 form.pwd1.focus();66 return false;67 }68 if(pwd1 != pwd2){69 alert(‘兩次密碼不相等‘);70 form.pwd2.select();71 return false;72 }73 var url = "foundpwd.php?user="+user+"&password="+pwd1;74 xmlhttp.open("GET",url,true);75 xmlhttp.onreadystatechange = function(){76 if(xmlhttp.readyState == 4){77 var msg = xmlhttp.responseText;78 if(msg == ‘1‘){79 alert(‘密碼修改成功,請重新登入‘);80 window.close();81 }else{82 alert(msg);83 }84 }85 }86 xmlhttp.send(null);87 }