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
|
<html>
<script type="text/javascript">
function Ajax(){
var xmlHttp;
try{
xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
}
catch (e)
{
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
}
catch (e)
{
try {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("No AJAX!?"); return false;
}
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById('ReloadThis').innerHTML=xmlHttp.responseText;
setTimeout('Ajax()',1000);
}
}
xmlHttp.open("GET","rand.php",true);
xmlHttp.send(null);
}
</script>
<body onLoad="Ajax()">
<div id="ReloadThis">Texte
<?php
$aleatoire1 = rand(1,18);
echo "<img src='Baniere (".$aleatoire1.").jpg'>";
?>
</div>
tralalla
<a href="www.google.fr">lien ver google</a>
<br />
Ajax c est bien quand ça fonctionne</body> </html> |
Partager