Object Properties
document.title//Set document title equivalent to the title tag of HTML
document.bgcolor//Set page background color
Document.fgcolor//Set foreground (text color)
Document.linkcolor//non-clicked link color
document.alinkcolor//Activate link (focus on this link) color
document.vlinkcolor//clicked 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.filesize//File size, read-only property
Document.cookie//Set up and read out cookies
Document.charset//Set character sets Simplified Chinese: gb2312
———————————————————————
Common Object Methods
document.write ()//write content to page dynamically
document.createelement (TAG)//Create an HTML tag object
document.getElementById (ID)//Get the object with the specified ID value
document.getelementsbyname (name)//Gets the object with the specified Name value
document.body.appendChild (Otag)
———————————————————————
body-Principal Sub-object
document.body//Specifies that the start and end of a document body is equivalent to body>/body>
Document.body.bgColor//Sets or gets the background color behind the object
Document.body.link//non-clicked link color
document.body.alink//Activate link (focus on this link) color
document.body.vlink//clicked link color
document.body.text//Text color
Document.body.innerText//Set text between Body>.../body>
Document.body.innerHTML//Set 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 image
Document.body.appendChild (Otag)//dynamically generate an HTML object
document.body.onclick=" func ( ) "//mouse pointer Click object is triggered
document.body.onmouseover=" func () "///mouse pointer is triggered when moving to object
document.body.onmouseout=" func () "///mouse pointer when moving out of object
———————————————————————
location-position sub-object
document.location.hash//#号后的部分
Document.location.host//domain + port number
document.location.hostname//Domain name
document.location.href//Full URL
Document.location.pathname//directory section
document.location.port//Port number
document.location.protocol//Network Protocol (http:)
document.location.search//sign
Documeny.location.reload ()//Refresh Web page
Document.location.reload (URL)//Open a new page
Document.location.assign (URL)//Open a new page
Document.location.replace (URL)//Open a new page
———————————————————————
selection-Selection Sub-object
Document.selection
———————————————————————
Images collection (images in a page)
A) by collection reference
Document.images//img tag on the corresponding page
Document.images.length//Number of IMG tags on the corresponding page
Document.images[0]//1th img Tag
Document.images[i]//i-1 img Tag
b) direct reference via Nane property
IMG name= "Oimage"
Document.images.oImage//document.images.name Properties
c) The SRC attribute of the reference picture
Document.images.oImage.src//document.images.name property. src
d) Create an image
var oimage
Oimage = new Image ()
Document.images.oimage.src= "1.jpg"
Also create an IMG/tag on the page that corresponds to the display
———————————————————————-
Forms collection (forms in a page)
A) by collection reference
Document.forms//The form label on the corresponding page
Document.forms.length//Number of/formform labels on the corresponding page
Document.forms[0]//1th/formform label
Document.forms[i]//i-1/formform label
Number of controls in Document.forms[i].length//I-1/formform
DOCUMENT.FORMS[I].ELEMENTS[J]//i-1/formform j-1 controls
b) direct reference by Tag Name property
/formform name= "Myform" >input name= "Myctrl"/>/form
Document. Myform.myctrl//document. Table sole name. Control Name
c) access the properties of the form
document.forms[i].name//corresponding form name> properties
document.forms[i].action//corresponding/formform action> property
document.forms[i].encoding//corresponding/formform enctype> properties
document.forms[i].target//corresponding/formform target> property
document.forms[i].appendchild (Otag)//Insert a control dynamically
DOCUMENT.ALL.ODIV//reference layer Odiv
document.all.odiv.style.display= "// The layer is set to visual
document.all.odiv.style.display= "none"//layer is set to hide
Span style= "FONT-SIZE:16PX;" >document.getelementid ("Odiv")//by Getelementid referencing object
document.getelementid (" ODiv "). Display= "None"
/*document.all represents a collection of all objects in document
only IE supports this attribute, so it is also used to determine the type of browser */
4 properties of a Layer object
document.getElementById ("ID"). InnerText//Dynamic output text
document.getElementById ("ID"). InnerHTML//Dynamic output HTML
document.getElementById ("ID"). Outertext//With innertext
document.getElementById ("ID"). outerHTML//With innerHTML
The Document object for JavaScript