ตรวจสอบระดับความปลอดภัยของ รหัสผ่านด้วย Ajax
หน้าแรก AJAX ตรวจสอบระดับความปลอดภัยของ รหัสผ่านด้วย Ajax
ไฟล์ pass_ajax.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
<html >
<head >
<title >Ajax Password ตรวจสอบระดับความปลอดภัยของ รหัสผ่านด้วย Ajax </title >
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" >
<style type="text/css" >
body {
background: #333;
color: #f8f8f8;
font: 12px 'lucida sans unicode', lucida, helvetica, verdana, arial, sans-serif;
text-align: center;
}
a:link, a:visited {
color: #f8f8f8;
text-decoration: underline;
}
#content{
border-top:dotted 2px #c0f813;
border-bottom:dotted 2px #c0f813;
}
#footer{
padding: 0px 0px 0px 0px;
margin: 125px 0px;
font-size: 9px;
}
</style >
<script type="text/javascript" language="Javascript" >
var http_request = false;
function makeRequest(url, parameters) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
// set type accordingly to anticipated content type
//http_request.overrideMimeType('text/xml');
http_request.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}
http_request.onreadystatechange = alertContents;
http_request.open('GET', url + parameters, true);
http_request.send(null);
}
function alertContents() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
result = http_request.responseText;
document.getElementById('myspan').innerHTML = result;
} else {
alert('There was a problem with the request.');
}
}
}
function get(obj) {
var getstr = "?";
for (i=0; i <obj.childNodes.length; i++) {
if (obj.childNodes[i].tagName == "INPUT") {
if (obj.childNodes[i].type == "text") {
getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
}
}
}
makeRequest('get.php', getstr);
}
</script >
</head >
<body >
<form action="javascript:get(document.getElementById('passform'));" name="passcheck" id="passcheck" >
พิมพ์รหัสผ่าน แล้วจะมีระดับความปลอดภัยของรหัสผ่านแสดงขึ้น
<p >
<input name="password" type="text" onKeyUp="javascript:get(this.parentNode);" >
</p >
</form >
<br/ >
<span id="myspan" > </span >
<br/ > <br/ >
<br/ >
</body >
</html >
ตัวอย่าง
ขึ้นไปด้านบน
