Los ejemplos de este artículo ilustran cómo JS muestra el tiempo del mundo. Compártelo para su referencia, como sigue:
<! DOCTYPE HTML public "-// w3c // dtd html 4.0 // en"> <html> <toad> <title> World Time, JS Web Page Effects </title> </Head> <Body BgColor = "#ffffff" onLoad = "JavaScript: GetTime ();"> <Script Language = "JavaScript"> <! GetTime () {var dt = new Date (); var def = dt.gettimezoneOffset ()/60; var gmt = (dt.gethours () + def); document.clock.local.value = (ifzero (dt.gethours ()) + ":" + ifzero (dt.getmines () + ":" + ":" + ":" Ifzero (dt.getSeconds ())); var ending = ":" + ifzero (dt.getmines ()) + ":" + ifzero (dt.getSeconds ()); var rome = check24 ((((gmt + 1)> 24)? ((Gmt + 1) - 24): (gmt + 1)); document.clock.rome (Ifzero (Roma) + finalización); var isr = check24 (((gmt + 2)> 24)? ((Gmt + 2) - 24): (gmt + 2)); document.clock.israel.value = (ifzero (isr) + finalización); var msw = check24 (((gmt + 3)> 24)? 3)); document.clock.msw.value = (ifzero (msw) + finalización); var baku = check24 (((gmt + 4)> 24)? ((Gmt + 4) - 24): (gmt + 4)); document.clock.baku.value = (ifZero (baku) + finalización); var di = check24 (((gmt + 5)>? ((gmt + 5) - 24): (gmt + 5)); document.clock.del.value = (ifzero (del) + finalización); var dh = check24 (((gmt + 6)> 24)? ((gmt + 6) - 24): (gmt + 6)); document.clock.dh.value = (ifcero (dh) = check24 ((((gmt +7)> 24)? ((gmt +7) - 24): (gmt +7)); document.clock.kok.value = (ifzero (kok) + finalización); var ho = check24 ((((gmt + 8)> 24)? ((gmt + 8) - 24): (gmt + 8); document.clock.clock.ho.value? (Ifzero (Ho) + finalización); var tky = check24 (((gmt + 8)> 24)? ((Gmt + 8) - 24): (gmt + 8)); document.clock.ho.value = (ifzero (ho) + finalización); var tky = check24 (((gmt + 9)> 24)? 9)); document.clock.tky.value = (ifzero (tky) + finalización); var sdn = check24 (((gmt + 10)> 24)? ((Gmt + 10) - 24): (gmt + 10)); document.clock.sdn.value = (ifZero (sdn) + finalización); var = check24 (((gmt + 11) ((gmt + 11) - 24): (gmt + 11)); document.clock.mag.value = (ifzero (mag) + finalización); var wll = check24 (((gmt + 12)> 24)? ((gmt + 12) - 24): (gmt + 12)); document.clock.wll.value = (ifcero (wll); = check24 ((((gmt)> 24)? (((gmt) - 24): (gmt)); document.clock._gmt.value = (ifzero (_gmt) + ":" + ifzero (dt.getMinutes ()) + ":" + ifzero (dt.getSeconds ())); var eniw = chech24 ((((gmt + (gmt + ifzero + (24-12))> 24)? (24-11)))); document.Clock.Sam.Value = (ifZero (Sam) + Ending); var Haw = check24 ((((gmt + (24-10))> 24)? ((Gmt + (24-10))-24): (gmt + (24-10)); = check24 ((((gmt + (24-9))> 24)? ((gmt + (24-9))-24): (gmt + (24-9)); document.clock.alaska.value = (ifzero (ala) + finalización); var pacif = check24 (((gmt + (24-8))> = 24)? (gmt + (24-8)));document.clock.pacif.value = (IfZero(pacif) + ending);var mount =check24(((gmt + (24-7)) > 24) ? ((gmt + (24-7)) - 24) : (gmt + (24-7)));document.clock.mount.value = (IfZero(mount) + ending);var center = check24 ((((gmt + (24-6))> 24)? ((gmt + (24-7))); document.clock.mount.value = (ifzero (Mount) + finalización); var Center = check24 (((GMT + (24-6))> 24)? ((GMT + (24-6))-24): (GMT + + (24-6)))); document.clock.center.value = (ifzero (centro) + finalización); var este = check24 (((gmt + (24-5))> 24)? = check24 ((((gmt + (24-4))> 24)? ((gmt + (24-4))-24): (gmt + (24-4)); document.clock.atl.value = (ifzero (atl) + finalización); var bra = check24 (((gmt + (24-3-3))> 24)? (GMT + (24-3))); Bra = (Bra> = 24)? (24-2))); Mid = (Mid> = 24)? Mid-24: Mid; Docum.Clock.Mid.Value = (Ifzero (Mid) + Ending); var azo = check24 (((GMT + (24-1))> 24)? ((GMT + (24-1))-24): (GMT + (24-1)); Azo = (AZO> = 24)? azo - 24: azo; document.clock.azo.value = (ifzero (azo) + finalización); setTimeOut ("getTime ()", 1000);} function ifzero (num) {return ((num <= 9)? ("0" + num): num);} function check24 (hora) {return (hora> = 24)? hora-24: hora;} // final-> </script> <form de nombre = "reloj"> <strong> local hora <input type = "text" size = "8" name = "local"> </strong> <p> eniwitok isla (gmt-12) <input type = "text" size = "8" name = "eniw"> <br> islas samoa (gmt-1) <input type = "size" "name =" eniw "> <br> samoa islas (gmt-1) <input type =" sea name = "Sam"> <br> Hawaii (GMT-10) <input type = "text" size = "8" name = "hawaii"> <p> alaska (gmt-9) <input type = "text" size = "8" name = "Alaska"> <br> Pacific Time (gmt-8) <input type = "text" size = "8" name = "Pacif" <<ril <<pr> (gmt-7) type = "text" size = "8" name = "monte"> <p> tiempo estándar central (gmt-6) <input type = "text" size = "8" name = "centro"> <br> East Time (gmt-5) <input type = "text" size = "8" name = "este"> <br> tiempo atlántico (gmt-4) <input type = "text" size = "8" name = "atl" Atl "brasil" (Gmt-3) <input type = "text" size = "8" name = "Bra"> <br> Mid-Atlantic Time (GMT-2) <input type = "text" size = "8" name = "mid"> <br> islas asyrianas (gmt-1) <input type = "text" size = "8" name = "azo"> <p> <strong> greenwich (gmt) (gmt) size = "8" name = "_ gmt"> </strong> <p> rome (gmt +1) <input type = "text" size = "8" name = "rome"> <br> israel (gmt +2) <input type = "text" size = "8" name = "israel"> <br> moscú (gmt +3) <input type = "text" size "8" 8 " name = "msw"> <p> baku (gmt +4) <input type = "text" size = "8" name = "baku"> <br> new delhi (gmt +5) <input type = "text" size = "8" name = "del"> <br> dhakar (gmt +6) <input type = "text" size = "8" name = "dh"> <p> bangkok (gmtkok (gmt +6) <input type = "text" size = "8" name = "kok"> <br> Hong Kong (gmt +8) <input type = "text" size = "8" name = "ho"> <br> tokio (gmt +9) <input type = "text" size = "8" name = "tky"> <p> sydney (gmt +8) +10) <input type = "text" size "8" 8 " name = "Sdn"> <br> Magadan (GMT +11) <input type = "text" size = "8" name = "mag"> <br> wellington (gmt +12) <input type = "text" size = "8" name = "wll"> </form> </body> </html>Los amigos interesados en la visualización de la hora y las fechas de JavaScript también pueden referirse a las herramientas en línea de este sitio :
Consulta de tiempo en línea en todo el mundo
Calendario perpetuo en línea
Calendario perpetuo web
For more information about JavaScript, please check this site's special topics: "Summary of JavaScript Time and Date Operation Skills", "Summary of JavaScript Switching Effects and Skills", "Summary of JavaScript Search Algorithm Skills", "Summary of JavaScript Animation Special Effects and Skills", "Summary of JavaScript Errors and Debugging Skills", "Summary of JavaScript Data Structures and Algorithm Skills", "Resumen del algoritmo y habilidades de traversal de JavaScript" y "Resumen del uso de la operación matemática de JavaScript"
Espero que este artículo sea útil para la programación de JavaScript de todos.