»
AnglaisFrançaisVietnamien

Imprimer - Clock Type script - JavaScriptBank.com

Version complète: jsB@nk » Heure » Horloge » Clock Type script
URL: https://www.javascriptbank.com/clock-type-script.html

Clock Type script © JavaScriptBank.comCeci est vraiment un pur petit script qui permet d'afficher l'heure dans la "Military Time» ou «12 Hour Time" avec la simple pression d'un bouton. Give it a try, il est soigné!

Version complète: jsB@nk » Heure » Horloge » Clock Type script
URL: https://www.javascriptbank.com/clock-type-script.html



JavaScript
<SCRIPT><!-- Beginvar change=1function showMilitaryTime(){  if(change!=1){button.value="24h";return true}    else button.value="12h";return false;}function showTheHours(hour){  if(showMilitaryTime()||(hour>0&&hour<13)){    if(hour==0)hour=12;return(hour);}  if(hour==0){return(12);}return(hour-12);}function showZeroFilled(inValue){  if(inValue>9){return inValue;}return "0"+inValue;}function showAmPm(){  if(showMilitaryTime()){return("");}  if(now.getHours()<12){return(" AM");}return(" PM");}function showTheTime(){  now=new Date()  hour=showZeroFilled(showTheHours(now.getHours()))  min=showZeroFilled(now.getMinutes())  sec=showZeroFilled(now.getSeconds())  ampm=showAmPm()  //this var defines how the clock will appear in the text box  //it is setup like an equasion  clock.value=hour+":"+min+":"+sec+ampm  setTimeout("showTheTime()",100)}onload=showTheTime// End --></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<INPUT id=clock style="BACKGROUND: #ffff33; WIDTH: 75px" size="20"><INPUT id=button onclick=change*=-1 style="BACKGROUND: #ffff33; WIDTH: 40px" type=button value=12h><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->