html Window and document the difference

Window - a representative of the browser window that opens:

Object Properties
  window // window itself
  window.self // = window.self reference in this window window
  the window.name // named window
  window.defaultStatus // set the window status bar
  window.location // URL address, with this arrangement properties can open a new page

Object method
  window.alert ( "text") // message session box
  window.confirm ( "text") // frame for confirming a session
  window.prompt ( "text") // claim keyboard input session box
  window.setIntervel ( "action ", time) // for each specified interval of time (in milliseconds) to perform one operation
  window.clearInterval () // clears action is to terminate the time arrangement with recurrent
  window.setTimeout (action, time) // specified time interval ( ms) performs one operation
  window.open () // new window
  window.close () // Close

Member objects
  window.event
  the window.document // See Detailed document object
  the window.history
  window.screen
  window.navigator
  the window.external
  ------------------------ ------------------- --------------------------
  the window.history target
  window .history.length // viewed page number
  history.back () // Back
  history.forward () // forward
  history.go (i) // forward or backward to the i-th page of history
  // i> progress 0, i <0 retracted
    ------------------------------------------- ------------------- ------
  window.screen objects
     window.screen.width // width of the screen
  window.screen.height // screen height
  window.screen .colorDepth // screen color depth
  window.screen.availWidth // width available
  window.screen.availHeight // available height (height to remove the taskbar)
  ---------------------------------- ------------------- ----------------
  the window.external objects
  window.external.AddFavorite ( "address", " title ") // add a site to the preservation clip
  -------------------------------------- ------------------- ------------
  window.navigator objects
  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 // client system language zh-cn Simplified Chinese
  window.navigator.userLanguage // user language, ibid
  window.navigator.appVersion // browser versions
  window.navigator.userAgent
  window.navigator.onLine // No user online
  window.navigator.cookieEnabled // whether the browser supports the cookie
  window. navigator.mimeTypes

The document object - on behalf of the entire HTML document, can be used to access all elements in the page:

Object Properties

document.title // Set the document title equivalent to the HTML of
document.bgColor // set the background color
document.fgColor // set the foreground color (text color)
document.linkColor // not clicked on the link color
document.alinkColor // activate the link (the focus on this link) color
document.vlinkColor // clicked link color
document.URL // URL attribute set to open another page 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 out the cookie
document.charset // Simplified Chinese character set: gb2312

Common Object Methods

document.write () // write dynamic content to pages
document.createElement_x (Tag) // create a html tag objects
document.getElementByIdx_x (ID) // for the specified object ID value
document.getElementsByName (Name) // for the specified Object Name value
document.body.appendChild (oTag)

body- the main sub-objects

document.body // specify the start and end of the document body is equivalent to
document.body.bgColor // set or get the background color of the object behind
document.body.link // not clicked on the link color
document.body.alink // activate the link (the focus on this link) color
document.body.vlink // clicked link color
document.body.text // text color
document.body.innerText // set the text between ...
the Document. HTML code between body.innerHTML // set ...
document.body.topMargin // margins on page
document.body.leftMargin // left page margin
document.body.rightMargin // on the right page margin
document.body.bottomMargin / under / page margins
document.body.background // background image
document.body.appendChild (oTag) // dynamically generate an HTML Object

Common Object Events

document.body.οnclick = "func ()" // the mouse pointer to click the object is triggered
document.body.οnmοuseοver = "func ()" // triggered when the mouse pointer over the object
document.body.οnmοuseοut = "func () "when the mouse pointer moves objects trigger //

location- location of child objects

document.location.hash part after // number #
document.location.host // domain name and port number
document.location.hostname // domain
document.location.href // complete the URL of
document.location.pathname // directory section
document .location.port // port number
document.location.protocol // network protocol (http :)
part document.location.search //? No. after

Common Object Events

documeny.location.reload () // refresh the page
document.location.reload (URL) // open a new page
document.location.assign (URL) // open a new page
document.location.replace (URL) // Open new page
=============================================== =========================
selection- selection sub-object
the document.selection
================= ================================================== =====
images set (image page):
----------------------------
a) set by the reference
document. images // the corresponding label on the page
document.images.length // number corresponding to the page tab
document.images [0] // 1st tag          
document.images [i] // i-1 th tag
- --------------------------
B) by direct reference to the attribute nane

document.images.oImage //document.images.name property
----------------------------
c) a reference picture of the src attribute
document. images.oImage.src //document.images.name property .sr

Guess you like

Origin www.cnblogs.com/2019gdiceboy/p/11887390.html