Firefox-use Greasemonkey to show local time to the page

Source: Internet
Author: User


$ ("Body"). Append ("<div id= ' addmytime ' style= ' font-size:25px; padding:5px; Background-color: #ccc; Color: #fff; position:fixed; top:100px; left:20px; ' > "+gettime () +" </div> ");functionGetTime () {varnow =NewDate (); varHH =now.gethours (); varMi =now.getminutes (); varSS =now.getseconds (); if(HH >= 0 && hh <= 9) {hh = "0" +hh;} if(Mi >= 0 && mi <= 9) {mi = "0" +mi;} if(SS >= 0 && SS <= 9) {ss = "0" +SS;} returnhh+ ":" +mi+ ":" +SS;}vartt = SetInterval (function(){ $("#addMyTime"). Text (GetTime ());},450);

has been synchronized with the time.windows.com, the local time with Baidu a few seconds, do not know how to return?

Greasemonkey, referred to as GM, the Chinese commonly known as "oil Monkey", is a Mozilla Firefox add-ons.

It allows users to install a number of scripts to make most HTML-based Web pages directly on the user side to change more easily.

Greasemonkey can add new features to Web pages, fix Web page errors, combine data from different Web pages, or count on other features that are not available for download.

A good Greasemonkey script even allows its output to be seamlessly integrated with the page being modified, as part of the original Web page.

If you want to add date, refer to:

functiongetnowformatdate () {varDate =NewDate (); varSeperator1 = "-"; varSeperator2 = ":"; varmonth = Date.getmonth () + 1; varStrdate =date.getdate (); if(Month >= 1 && month <= 9) {Month= "0" +month; }    if(strdate >= 0 && strdate <= 9) {strdate= "0" +strdate; }    varcurrentdate = date.getfullyear () + seperator1 + month + Seperator1 +strdate+ "" + date.gethours () + Seperator2 +date.getminutes ()+ Seperator2 +date.getseconds (); returncurrentdate;} 

Firefox-use Greasemonkey to show local time to the page

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.