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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TEST</title>
<meta name="description" content="Descriptions..." />
<meta name="Keywords" content="Mots, clefs" />
<script type="text/javascript" src="oXHR.js"></script>
<script type="text/javascript">
function test()
{
var xhr = getXMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 0)) {
xhr.responseText;
document.getElementById("loader").style.display = "none";
document.getElementById("maj1").style.display = "inline";
setTimeout("move()",5000);
} else if (xhr.readyState < 4) {
document.getElementById("loader").style.display = "inline";
}
};
xhr.open("POST","script.php",true);
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
//-----------
prenom = document.getElementById('prenom').value;
//-----------
xhr.send("test_prenom="+prenom);
document.getElementById('prenom').value = "";
}
function move()
{
document.getElementById("maj1").style.display = "none";
}
function erreur()
{
document.getElementById("maj2").style.display = "inline";
}
</script>
</head>
<body>
<input type="text" id="prenom" /> <span id="loader" style="display:none;"><img src="../../img/loading2.gif" alt="loading" /></span>
<br /><br />
<a href="javascript:test();" title="" />envoyer</a>
<span id="maj1" style="display:none;"><img src="../../img/edit_yes.png" alt="loading" /></span>
<span id="maj2" style="display:none;"><img src="../../img/edit_no.png" alt="loading" /></span>
</body>
</html> |