Case: Beauty Clock
Ideas:
Open the page there is a picture in the order of rotation per second, use a date object, get hours and seconds.
After the package to a named function, in order to make the page punch card had pictures of rotation, first call at f1, and then set the setInterval
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>title</title> </head> <body> <img src="" alt="" id="im" /> <script src="common.js"></script> <script> function f1() { //Obtain the current time var dt = new new a Date (); // Get hours var hour = dt.getHours (); // Get second var SECOND = dt.getSeconds (); hour = hour < 10 ? " 0 " + hour: hour ; SECOND = SECOND < 10 ? " 0 " + SECOND: SECOND; My $ ( " IM " ) .src = " Meimei / " + Hour + " _ " + SECOND, + " .jpg " ; } // Open the first page calls f1, so open to have pictures, without waiting for f1 (); // After the page loads wow paralysis, over 1, seconds before execution of the function code the setInterval (F1, 1000 ); </ Script > </ body > </ HTML >