Detailed description of the window object and document Object in HTML, windowdocument
Window -- indicates an opened Window in the browser:
Object Attributes
Window // window itself
Window. self // reference this window = window. self
Window. name // name the window
Window. defaultStatus // set the window status bar Information
Window. location // URL address. You can set this attribute to open a new page.
Object Method
Window. alert ("text") // prompt message session box
Window. confirm ("text") // confirm the session box
Window. prompt ("text") // enter the session box on the keyboard.
Window. setIntervel ("action", time) // The operation is executed every specified time (milliseconds ).
Window. clearInterval () // The clearing time is configured to terminate the cycle.
Window. setTimeout (action, time) // The operation is executed every specified time (milliseconds ).
Window. open () // open a new window
Window. close () // close the window
Member object
Window. event
Window.doc ument // For details, see the document object
Window. history
Window. screen
Window. navigator
Window. external
---------------------------------------------------------------------
Window. history Object
Window. history. length // Number of browsed pages
History. back () // back
History. forward () // forward
History. go (I) // forward or backward to the I page of the history
// I> 0 progress, I <0 back
--------------------------------------------------------------------
Window. screen Object
Window. screen. width // screen width
Window. screen. height // screen height
Window. screen. colorDepth // screen color depth
Window. screen. availWidth // available width
Window. screen. availHeight // available height (excluding the height of the taskbar)
---------------------------------------------------------------------
Window. external Object
Window. external. AddFavorite ("Address", "title") // Add the website to the folder
---------------------------------------------------------------------
Window. navigator object
Window. navigator. appCodeName // browser code name
Window. navigator. appName // browser application name
Window. navigator. appMinorVersion // browser patch version
Window. navigator. cpuClass // CPU type x86
Window. navigator. platform // operating system type win32
Window. navigator. plugins
Window. navigator. opsProfile
Window. navigator. userProfile
Window. navigator. systemLanguage // zh-cn Simplified Chinese
Window. navigator. userLanguage // user language, same as above
Window. navigator. appVersion // browser version
Window. navigator. userAgent
Window. navigator. onLine // whether the user is onLine
Window. navigator. cookieEnabled // does the browser support cookies?
Window. navigator. mimeTypes
Document Object -- represents the entire HTML document and can be used to access all elements on the page:
Object Attributes
Document. title // set the document title is equivalent to the <title> tag of HTML.
Document. bgColor // set the background color of the page
Document. fgColor // set the foreground color (text color)
Document. linkColor // The link color that has not been clicked
Document. alinkColor // the color of the activation Link (focus on this link)
Document. vlinkColor // the color of the clicked Link
Document. URL // set the URL attribute to open another webpage in the same window
Document. fileCreatedDate // file creation date, read-only attribute
Document. fileModifiedDate // file modification date, read-only attribute
Document. fileSize // file size, read-only attribute
Document. cookie // set and read cookies
Document. charset // set the character set to simplified Chinese: gb2312
Common Object Methods
Document. write () // dynamically write content to the page
Document. createElement (Tag) // create an html Tag object
Document. getElementById (ID) // get the object with the specified ID value
Document. getElementsByName (Name) // get the object with the specified Name value
Document. body. appendChild (oTag)
Body-subject sub-Object
Document. body // specify the beginning and end of the document body, which is equivalent to <body> </body>
Document. body. bgColor // set or obtain the background color behind the object
Document. body. link // the color of the link that has not been clicked
Document. body. alink // the color of the activation Link (focus on this link)
Document. body. vlink // the color of the clicked Link
Document. body. text // text color
Document. body. innerText // set the text between <body>... </body>
Document. body. innerHTML // set the HTML code between <body>... </body>
Document. body. topMargin // top margin of the page
Document. body. leftMargin // left margin of the page
Document. body. rightMargin // right margin of the page
Document. body. bottomMargin // bottom margin of the page
Document. body. background // background image
Document. body. appendChild (oTag) // dynamically generate an HTML Object
Common Object events
Document. body. onclick = "func ()" // The mouse pointer clicks the object to be triggered
Document. body. onmouseover = "func ()" // triggered when the mouse pointer is moved to an object
Document. body. onmouseout = "func ()" // triggered when the mouse pointer is removed from an object
Location-location sub-Object
Part after document. location. hash // #
Document. location. host // domain name + port number
Document. location. hostname // Domain Name
Document. location. href // complete URL
Document. location. pathname // directory
Document. location. port // port number
Document. location. protocol // network protocol (http :)
Document. location. search //? Part after
Common Object events
Using eny. location. reload () // refresh the webpage
Document. location. reload (URL) // open a new webpage
Document. location. assign (URL) // open a new webpage
Document. location. replace (URL) // open a new webpage
========================================================== ======================================
Selection-selection Sub-Object
Document. selection
========================================================== ======================================
Images set (images in the page ):
----------------------------
A) reference through a set
Document. images // The label on the corresponding page
Document. images. length // Number of labels on the corresponding page
Document. images [0] // 1st tags
Document. images [I] // The I-1 label
----------------------------
B) direct reference through the nane attribute
Document. images. oImage // document. images. name attribute
----------------------------
C) reference the image's src attribute
Document. images. oImage. src // document. images. name attribute. src