Satwant, Merci pour ur réponse,
Je ne sais pas la programmation ajax
s'il vous plaît me donner le code comment faire fonctionner sur les fenêtres.
Première: chaque fois que U rencontre New Words développement toujours essayer de les Google et les apprendre. Parce que U leur savoir qu'une seule fois et ils vous aideront à vie

Au lieu de cela par écrit ajax, pouvons-nous utiliser php?
Pas directement avec php, mais avec le langage HTML, u peut le faire en réglant Meta rafraîchir la page dans la section HEAD de votre page html
code suivant créer une page pour se rafraîchir après 5 secondes
<html>
<head>
<meta http-equiv="refresh" content="5" /> </head></html>
- <html>
- <head>
- <meta http-equiv="refresh" content="5" /> </head></html>
si oui s'il vous plaît me donner le code, son urgence
Je fais un exemple très simple de montrer que ce simple concept. Avant de mettre en œuvre cette u please Essayez de comprendre l'utilisation des fonctions
Voici Code JavaScript et HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Random Country Select By Satwant Hundal</title>
<script type="text/javascript">
/* By: Satwant Hundal
Script : Usage of Set Interval For Ajax Calls
*/
//This is Function to call Over Certain Interval
var i_am_Function=function()
{
// following code is used to initiate Ajax call Object Called XMLHTTPOBJECT
xmlhttp="";
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
//Function to Handle Data Send By Php Code from Server
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
//code to update Your Html Page
var x=document.getElementById('country_name');
x.innerHTML='Ramdom Country:'+xmlhttp.responseText;
}
};
xmlhttp.open("GET",'data.php',true);
xmlhttp.send();
}
window.onload=function(e)
{
// Seeting Up Set Interval Function to 5000 millisecond which means 5 seconds
//for Hour you need to put 3600000
i_am_Function();
var TimeOutId=setInterval(i_am_Function, 5000);
// Time Out ID is Used to Identify Particular Set Interval. Use this to Clear it when u dont
//need it.
//clearInterval(TimeOutId);
}
</script>
<style type="text/css">
#country_name
{
width: 100%; height: 100%; font-size: 80px;
}
</style>
</head>
<body>
<!-- This is Place which is Updated By Above Code -->
<div id="country_name"></div>
</body>
</html>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <html>
- <head>
- <title>Random Country Select By Satwant Hundal</title>
- <script type="text/javascript">
- /* By: Satwant Hundal
- Script : Usage of Set Interval For Ajax Calls
- */
- //This is Function to call Over Certain Interval
- var i_am_Function=function()
- {
- // following code is used to initiate Ajax call Object Called XMLHTTPOBJECT
- xmlhttp="";
- if (window.XMLHttpRequest)
- {// code for IE7+, Firefox, Chrome, Opera, Safari
- xmlhttp=new XMLHttpRequest();
- }
- else
- {// code for IE6, IE5
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- //Function to Handle Data Send By Php Code from Server
- xmlhttp.onreadystatechange=function()
- {
- if (xmlhttp.readyState==4 && xmlhttp.status==200)
- {
- //code to update Your Html Page
- var x=document.getElementById('country_name');
- x.innerHTML='Ramdom Country:'+xmlhttp.responseText;
- }
-
- };
- xmlhttp.open("GET",'data.php',true);
- xmlhttp.send();
- }
- window.onload=function(e)
- {
- // Seeting Up Set Interval Function to 5000 millisecond which means 5 seconds
- //for Hour you need to put 3600000
- i_am_Function();
- var TimeOutId=setInterval(i_am_Function, 5000);
- // Time Out ID is Used to Identify Particular Set Interval. Use this to Clear it when u dont
- //need it.
- //clearInterval(TimeOutId);
- }
- </script>
- <style type="text/css">
- #country_name
- {
- width: 100%; height: 100%; font-size: 80px;
- }
- </style>
- </head>
- <body>
- <!-- This is Place which is Updated By Above Code -->
- <div id="country_name"></div>
- </body>
- </html>
Ce code est mémorisé dans le serveur dans un fichier PHP
// Your Connection String Replace UserName and Password
$con = mysql_connect("localhost","YOUR USER NAME","YOUR PASSWORD") or die("Error: ".mysql_error());
//Your DATABASE NAME where country table is stored
mysql_select_db('ssb',$con) or die("Error: ".mysql_error());
$sql="SELECT * FROM `country` ORDER BY RAND() LIMIT 0,1";
$record=mysql_query($sql,$con) or die("Error: ".mysql_error());
$row=mysql_fetch_row($record);
print_r($row[1]);
mysql_close($con) or die("Error: ".mysql_error());
- // Your Connection String Replace UserName and Password
- $con = mysql_connect("localhost","YOUR USER NAME","YOUR PASSWORD") or die("Error: ".mysql_error());
- //Your DATABASE NAME where country table is stored
- mysql_select_db('ssb',$con) or die("Error: ".mysql_error());
- $sql="SELECT * FROM `country` ORDER BY RAND() LIMIT 0,1";
- $record=mysql_query($sql,$con) or die("Error: ".mysql_error());
- $row=mysql_fetch_row($record);
- print_r($row[1]);
- mysql_close($con) or die("Error: ".mysql_error());
Vous pouvez télécharger par exemple complet de mon site
http://satwant(.)tk/publicDownload/CountryExample.zip