Membres


Pas encore membre ?
inscrivez-vous ici

Connexion :
Login
Code
Mot de passe perdu ?
Liste des membres

Afficher l heure en javascript - Cours javascript

Afficher l heure en javascript

Afficher l heure en javascript


Afficher l'heure en Javascripts

1.Copier coller ce code entre <BODY> et </BODY> :

<script language="JavaScript"><!--
// Helpers for JSI page...
// Netscapes Clock - Start
// this code was taken from Netscapes JavaScript documentation at
// www.netscape.com on Jan.25.96

var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function startclock () {
// Make sure the clock is stopped
stopclock();
showtime();
}
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = " " + ((hours >23) ? hours -23 :hours)
timeValue += ((minutes < 10) ? "h0" : "h") + minutes
document.clock.face.value = timeValue;
// you could replace the above with this
// and have a clock on the status bar:
// window.status = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
// Netscapes Clock - Stop
// end Helpers
// --></script>




2.ajouter ce bout de code dans la balise <BODY>:
onload="startclock()"


Exemple:
<body onload="startclock()">

Le 12/05/2008 par Sky
http://www.graphiks.net




Les commentaires

Nom :

Texte :

Recopier ce code : ici

Nous  -  Plan du site  -  Informations légale  -  Contact  -  © Graphiks.net