SetTimeout, Unit is milliseconds
SetTimeout (time code, timer delay);
eg
SetTimeout ("Alert (' Wake up! ')", 100000);
The Document object represents the Web page code itself
Modify the User window (not the entire browser) size, can be used body.clientwidth, body.clientheight, so that can adapt to the size of different windows, if you want to dynamically according to the size of the current window to change the size, you can use onresize trigger.
function Resize () { ...} ... <body onload = "resize ();" onresize = "resize ();" >
JavaScript clears all the variables when the browser is closed, so the entire script is rerun every time the page is reopened. If you need some variables that can be recorded and reused, you can use cookies to record the variables when you close the page.
Cookies
Name = Jackexpires 11/11/2014
The use of the cookie is to declare its expires end time, and the end time will be automatically deleted, if no declaration end time is treated as normal variable, when the browser is closed. Use between cookies; Examples of usage functions for cookies:
function Writecookie (name, value, days) {//By default , there is no expiration so the cookie is temporaryvar expires = "";//specifying a number of days makes the cookie Persis Tentif (days) {var date = new Date ();d ate.settime (Date.gettime () + (days * + *)); expires = "; Expires= "+ date.togmtstring ();} Set the cookie to the name, value, and expiration Datedocument.cookie = name + "=" + value + Expires + "; path=/";} function Readcookie (name) {//Find the specified cookie and return its valuevar searchname = name + "="; var cookies = docu Ment.cookie.split (';'); for (var i = 0; i < cookies.length; i++) {var c = cookies[i];while (C.charat (0) = = ")//Remove opening extra space c = c.substring (1, C . length); if (C.indexof (searchname) = = 0) return c.substring (Searchname.length, c.length);} return null; No results returned null}function Erasecookie (name) {//Erase the specified Cookiewritecookie (name, "",-1);}
You can put these functions into a file in the. js suffix.
Navigator.cookieenabled can see if cookies are currently available
Head first JavaScript (iii)