JS shows the world time sample (including the world's major cities) _javascript skills

Source: Internet
Author: User
Tags local time time and date

This example describes the way JS shows world time. Share to everyone for your reference, specific as follows:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" > <HTML> <HEAD> <TITLE> World time, JS page special effects </ title> </HEAD> <body bgcolor= "#ffffff" onload= "Javascript:gettime ();" > <script language= "JavaScript" > <!--Begin function GetTime () {var dt = new Date (); var def = Dt.gettimezon
Eoffset ()/60;
var GMT = (dt.gethours () + def);
Document.clock.local.value = (Ifzero (dt.gethours ()) + ":" + Ifzero (dt.getminutes ()) + ":" + Ifzero (Dt.getseconds ()));
var ending = ":" + Ifzero (dt.getminutes ()) + ":" + Ifzero (Dt.getseconds ()); var Rome =check24 ((GMT + 1) > 24)?
(GMT + 1): (GMT + 1));
Document.clock.rome.value = (Ifzero (Rome) + ending); var ISR =check24 ((GMT + 2) > 24)?
(GMT + 2): (GMT + 2));
Document.clock.Israel.value = (Ifzero (ISR) + ending); var msw =check24 ((GMT + 3) > 24)?
(GMT + 3): (GMT + 3));
Document.clock.msw.value = (Ifzero (MSW) + ending); var Baku =check24 ((GMT + 4) > 24)? (GMT + 4): (GMT + 4));
Document.clock.baku.value = (Ifzero (Baku) + ending); Var del =check24 ((GMT + 5) > 24)?
(GMT + 5): (GMT + 5));
Document.clock.del.value = (Ifzero (del) + ending); var dh =check24 ((GMT + 6) > 24)?
(GMT + 6): (GMT + 6));
Document.clock.dh.value = (Ifzero (DH) + ending); var Kok =check24 ((GMT +7) > 24)?
(GMT +7): (GMT + 7));
Document.clock.kok.value = (Ifzero (kok) + ending); var ho =check24 ((GMT + 8) > 24)?
(GMT + 8): (GMT + 8));
Document.clock.ho.value = (Ifzero (HO) + ending); var tky =check24 ((GMT + 9) > 24)?
(GMT + 9): (GMT + 9));
Document.clock.tky.value = (Ifzero (tky) + ending); VAR Sdn =check24 ((GMT +) > 24)?
(GMT + 10): (GMT + (+));
Document.clock.sdn.value = (Ifzero (SDN) + ending); var mag =check24 ((GMT + one) > 24)?
(GMT + one)-(GMT + 11));
Document.clock.mag.value = (Ifzero (MAG) + ending); var wll =check24 ((GMT +) > 24)?
(GMT + 12): (GMT +)); Document.clock.wll. Value = (Ifzero (WLL) + ending); var _gmt =check24 ((GMT) > 24)?
(GMT): (GMT));
Document.clock._gmt.value = (Ifzero (_GMT) + ":" + Ifzero (dt.getminutes ()) + ":" + Ifzero (Dt.getseconds ())); var eniw =check24 ((GMT + (24-12)) > 24)?
(GMT + (24-12)): (GMT + (24-12)));
Document.clock.eniw.value = (Ifzero (ENIW) + ending); var Sam =check24 ((GMT + (24-11)) > 24)?
(GMT + (24-11)): (GMT + (24-11)));
Document.clock.sam.value = (Ifzero (SAM) + ending); var haw =check24 ((GMT + (24-10)) > 24)?
(GMT + (24-10)): (GMT + (24-10)));
Document.clock.Hawaii.value = (Ifzero (Haw) + ending); var ala =check24 ((GMT + (24-9)) > 24)?
(GMT + (24-9)): (GMT + (24-9)));
Document.clock.alaska.value = (Ifzero (ALA) + ending); var pacif =check24 ((GMT + (24-8)) >= 24)?
(GMT + (24-8)): (GMT + (24-8)));
Document.clock.pacif.value = (Ifzero (PACIF) + ending); var mount =check24 ((GMT + (24-7)) > 24)?
(GMT + (24-7)): (GMT + (24-7))); Document. Clock.mount.value = (Ifzero (mount) + ending); var center =check24 ((GMT + (24-6)) > 24)?
(GMT + (24-6)): (GMT + (24-6)));
Document.clock.center.value = (Ifzero (center) + ending); var East =check24 ((GMT + (24-5)) > 24)?
(GMT + (24-5)): (GMT + (24-5)));
Document.clock.east.value = (Ifzero (east) + ending); var atl =check24 ((GMT + (24-4)) > 24)?
(GMT + (24-4)): (GMT + (24-4)));
Document.clock.atl.value = (Ifzero (ATL) + ending); var bra =check24 ((GMT + (24-3)) > 24)?
(GMT + (24-3)): (GMT + (24-3))); Bra = (Bra >= 24)?
Bra-24:bra;
Document.clock.bra.value = (Ifzero (BRA) + ending); var mid =check24 ((GMT + (24-2)) > 24)?
(GMT + (24-2)): (GMT + (24-2))); Mid = (Mid >= 24)?
Mid-24:mid;
Document.clock.mid.value = (Ifzero (mid) + ending); var azo =check24 ((GMT + (24-1)) > 24)?
(GMT + (24-1)): (GMT + (24-1))); Azo = (azo >= 24)?
Azo-24:azo;
Document.clock.azo.value = (Ifzero (azo) + ending); SettimeoUT ("GetTime ()", 1000); function Ifzero (num) {return (num <= 9)?
("0" + num): num); function Check24 (hour) {return (hour >=) hour-24:hour;}//End--> </script> <form name= "clock "> <strong>local time <input type=" text size= "8" name= "local" ></strong> <p> Eniwitock (GMT-12) <input type= "Text" size= "8" name= "Eniw" ><br> Samoan Is. (GMT-11) <input type= "text" size= "8" 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" ><br> Mountain Time (GMT-7) & Lt;input type= "Text" size= "8" name= "mount" > <p> Central Standard Time (GMT-6) <input type= "text" size= "8" name= "Center" > <br> Eastern Time (GMT-5) <input type= "text" size= "8" name= "East" ><br> Atlantic Time (GMT-4) <input type= "text" size = "8" name= "ATL" > <p> brazilia (GMT-3) <input type= "text"Size=" 8 "name=" Bra "><br> mid-Atlantic Time (GMT-2) <input type=" text "size=" 8 "name=" mid "><br> Assyrian Islands (GMT-1 ) <input type= "text" size= "8" name= "Azo" > <p> <strong> Greenwich Standard Time (GMT) <input type= "text" size= "8" nam E= "_gmt" ></strong> <p> Rome (GMT + 1) <input type= "text" size= "8" name= "Rome" ><br> Israel (GMT +2) &L T;input type= "Text" size= "8" name= "Israel" ><br> Moscow (GMT +3) <input type= "text" size= "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 (GMT +7) <input Ty  Pe= "Text" size= "8" name= "Kok" ><br> Hong Kong (GMT +8) <input type= "text" size= "8" name= "Ho" ><br> Tokyo (GMT +9) <input type= "Text" size= "8" name= "Tky" > <p> Sydney (GMT +10) <input type= "text" size= "8" Name= "SDN" ><br&
Gt Magadan (GMT +11) &LT;INPUT type= "text" size= "8" name= "Mag" ><br> Wellington (GMT +12) <input type= "text" size= "8" name= "WLL" > </form&gt
;

 </BODY> </HTML>

friends who are interested in JavaScript time and date can also refer to the online tools of this site :

Online Worldwide Time Query

Online Perpetual calendar

Web Calendar

More about JavaScript related content to view the site topics: "JavaScript time and date Operation skills Summary", "JavaScript switching effects and techniques summary", "JavaScript Search Algorithm Skills summary", " JavaScript animation effects and tips Summary, "JavaScript Error and debugging skills Summary", "JavaScript data structure and algorithm skills summary", "JavaScript traversal algorithm and Skills summary" and "JavaScript Mathematical operation Usage Summary"

I hope this article will help you with JavaScript programming.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.