Object Properties
Document.title//Set document title equivalent to HTML title tag
Document.bgcolor//Set page background color
Document.fgcolor//Set foreground colors (text color)
Document.linkcolor//not-clicked link color
Document.alinkcolor//Activate the color of the link (focus on this link)
Document.vlinkcolor//clicked on link color
Document.url//Set URL property to open another page in the same window
Document.filecreateddate//File creation date, read-only property
Document.filemodifieddate//File modification date, read-only property
Document.charset//Set character set Simplified Chinese: gb2312
Document.filesize//File size, read-only property
Document.cookie//Set up and read out cookies
———————————————————————
Common Object Methods
document.write ()///write content dynamically to page
Document.createelement (tag)//Create an HTML tag object
document.getElementById (ID)//Get object with specified ID value
Document.getelementsbyname (name)//Get object with specified name value
Document.body.appendchild (Otag)
———————————————————————
body-the principal child object
Document.body//Specifies that the start and end of the document body is equivalent to body>/body>
Document.body.bgcolor//Sets or gets the background color behind the object
Document.body.link//not-clicked link color
Document.body.alink//Activate the color of the link (focus on this link)
Document.body.vlink//clicked on link color
Document.body.text//Text color
Document.body.innertext//Set the text between body>.../body>
document.body.innerhtml//Set of HTML code between body>.../body>
Document.body.topmargin//page top margin
Document.body.leftmargin//Page left margin
Document.body.rightmargin//Page right margin
Document.body.bottommargin//Page Bottom margin
Document.body.background//Background picture
Document.body.appendchild (Otag)//dynamically generate an HTML object
Common Object Events
Document.body.onclick= "func ()"//mouse pointer Click object is triggered
Document.body.onmouseo Tutorial Ver= "func ()"///mouse pointer moves to object when triggered
Trigger when document.body.onmouseout= "func ()"//mouse pointer moves out of an object
———————————————————————
location-Position child Object
Document.location.hash//#号后的部分
Document.location.host//domain + port number as if the host name localhost returned, no return port number
Document.location.hostname//Domain
Document.location.href//Full URL
Document.location.pathname//directory section
Document.location.port//Port number
Document.location.protocol//Network Protocol (http:)
Document.location.search//number of parts after
Documeny.location.reload ()//Refresh Page
Document.location.reload (URL)//Open new page
Document.location.assign (URL)//Open new page
Document.location.replace (URL)//Open new page
relatively inefficient. Depending on this, the following processing can increase the speed:
var doc = document;
Document Slow
Doc This is faster than the above (document)
Although the above can be used to write directly, but the document used before the place to replace, this is a bit of a little trouble. So, look at the following:
var doc = document;
var document = doc;
It would be great if it could be achieved ...
People who understand web effects should know that JavaScript variables are generated at the very beginning, so the document becomes undefined.
Never mind, keep on improving ~
var doc = document;
Eval (' var document = Doc ');
The role of Eval is to change variables within scope, so that the subsequent document can be used normally.
Finally, add only the conditions that are valid in IE, just like the following is OK ~
Copy code code as follows:
/
* @cc_on
var doc = document;
Eval (' var document = Doc ');
@*/
Extrapolate, as in the following notation, global variables other than document can also be accelerated by using the above method.
Copy code code as follows:
/
* @cc_on
Eval (function (props tutorial) {
var code = [];
for (var i = 0 L = props.length;i<l;i++) {
var prop = Props[i];
Window[' _ ' +prop]=window[prop];
Code.push (prop+ ' =_ ' +prop)
}
Return ' var ' +code.join (', ');
} (' document self top parent alert SetInterval clearinterval
SetTimeout cleartimeout '. Split ("));
@*/