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
|
<html><head></head>
<body>
<script type="text/javascript">
function xxx(id2, newtext) {
document.getElementById('destinataire'+id2).value = newtext;
}
function writediv(id, texte)
{
document.getElementById('nompbox'+id).innerHTML = texte;
}
function verifPseudo(id, nomp)
{
if(nomp != '')
{
if(nomp.length<3)
writediv(id, '<span style="color:#cc0000"><b>'+nomp+' :</b> ce pseudo est trop court</span>');
else if(nomp.length>30)
writediv(id, '<span style="color:#cc0000"><b>'+nomp+' :</b> ce pseudo est trop long</span>');
else
writediv(id, file('ajax.php?destinataire='+escape(nomp)+'&id='+(id)))
}
}
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("GET", fichier, false);
xhr_object.send(null);
if(xhr_object.readyState == 4) return(xhr_object.responseText);
else return(false);
}
</script>
<br><br> Mots dans la Base de données : "Pomme" , "Poire", "Ananas" , "Prune", "Pommes" (le serveur de lycos étant un peu lent des fois, il faut insister)<br>
Même s'il indique que l'acces est interdit, taper qq lettre de plus <br> <br>
<form method="get" action="bd.php">
Produit testé = <input type="text" id="destinataire1" name="destinataire1" onkeyup="verifPseudo(1,this.value)" /><div id="nompbox1"></div>
Produit testé = <input type="text" id="destinataire2" name="destinataire2" onkeyup="verifPseudo(2,this.value)" /><div id="nompbox2"></div>
<input type="submit" name="submit" value="Envoyer la valeur" />
</form>
</html> |
Partager