1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
<script type="text/javascript">
function writediv(texte)
{
document.getElementById('ville').innerHTML = texte;
}
function verifVille(cp)
{
if(cp != '')
{
if(cp.length<5)
writediv('<span style="color:#cc0000"><b>'+cp+' :</b> ce Code Postal est court</span>');
else if(texte = file('Page2.asp?cp='+escape(cp)))
{
if(texte == "ok")
writediv('<span style="color:#cc0000"><b>'+cp+' :</b> ce Code Postal existe</span>');
else if(texte == "no")
writediv('<span style="color:#1A7917"><b>'+cp+' :</b> ce Code Postal n existe pas</span>');
else
writediv('');
}
}
}
function file(fichier)
{
if(window.XMLHttpRequest) // FIREFOX
xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // IE
xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
else
return(false);
xhr_object.open("POST", fichier, true);
xhr_object.send(null);
if(xhr_object.readyState == 4) return(xhr_object.responseText);
else return(false);
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<input type="text" name="cp" onKeyUp="verifVille(this.value)" />
<div id="ville"></div>
</form>
</body>
</html> |