Document attributes and methods of JS

Source: Internet
Author: User
JS Document attributes and Methods document. title // set the document title is equivalent to the title Tag document of HTML. bgColor // set the background color of the page document. fgColor // set the foreground color (text color) document. linkColor // The link color document that has not been clicked .... JS Document attributes and Methods document. title // set the document title is equivalent to the title Tag document of HTML. bgColor // set the background color of the page document. fgColor // set the foreground color (text color) document. linkColor // The link color document that has not been clicked. alinkColor // The Color document of the activation Link (focus on this link. vlinkColor // The selected link color document. URL // set the URL attribute to open another webpage document in the same window. FileCreatedDate // file creation date, read-only attribute document. fileModifiedDate // file modification date, read-only attribute document. charset // set the character set to simplified Chinese: gb2312document. fileSize // file size, read-only attribute document. cookie // set and read the cookie ----------------------- Common Object method document. write () // dynamically write content to the page document. createElement (Tag) // create an html Tag object document. getElementById (ID) // get the object document with the specified ID value. getElementsByName (Name) // get the object document with the specified Name value. body. appendChild (oTag )-------------------- --- Body-subject sub-object document. body // specify the beginning and end of the document body. It is equivalent to body>/body> document. body. bgColor // set or obtain the background color document after the object. body. link // The link color document that has not been clicked. body. alink // activation Link (focus on this link) color document. body. vlink // The selected link color document. body. text // text document. body. innerText // set the body>... /Body> text between document. body. innerHTML // set body>... /Body> between HTML code document. body. topMargin // The top margin of the page document. body. leftMargin // the left of the page is from document. body. rightMargin // the right side of the page is from document. body. bottomMargin // The bottom margin of the page document. body. background // background image document. body. appendChild (oTag) // dynamically generates an HTML object Common Object event document. body. onclick = "func ()" // The mouse pointer clicks the object to trigger the document. body. onmouseover = "func ()" // triggers document when the mouse pointer moves to an object. body. onmouseout = "func ()" // triggered when the mouse pointer is removed from the object --------------------- location-location Sub-object document. location. part of the document after hash. location. host // domain name + port number // it seems that the returned host name is localhost, and no document port is returned. location. hostname // domain name document. location. href // complete URLdocument. location. pathname // directory part document. location. port // port number document. location. protocol // network protocol (http: document. location. search //? Part of the signature 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-Select Sub-object document. selection for example: select some text here. <script type="text/javascript" language="javascript"> The createRange method document. selection. createRange () of selection returns a TextRange object based on the current text selection, or returns a ControlRange object based on the control selection. ExecCommand can be used in HTML editors, such as bold text, italic text, copying, pasting, and hyperlink creation. These seem to be implemented only in IE .. ----------------------- Images set (image in the page) a) References document through the set. images // the img Tag document on the corresponding page. images. length // The number of img labels on the corresponding page document. images [0] // 1st img tags document. images [I] // I-1 img Label B) References img name = "oImage" document directly through the name attribute. images. oImage // document. images. name attribute c) reference the image's src attribute document. images. oImage. src // document. images. name attribute. srcd) create an image var oImageoImage = new image(registrdocument.images.oimage.src000000001.jpg "and create an img/Tag corresponding to it on the page to display ---------------------- forms set (Form in the page)) reference document through a collection. forms // The form tag document on the corresponding page. forms. length // corresponds to the number of/formform labels on the page document. forms [0] // 1st/formform tag document. forms [I] // The I-1/formform tag document. forms [I]. length // The number of controls in the I-1/formform document. forms [I]. elements [j] // The I-1 control B in the J-1/formform) use the label name property to directly reference/formform name = "Myform"> input name = "myctrl"/>/formdocument. myform. myctrl // document. form name. control name c) Access Form attribute document. forms [I]. name // corresponding form name> attribute document. forms [I]. action // corresponding to/formform action> attribute document. forms [I]. encoding // corresponds to/formform enctype> terradocument.formspoliciunc.tar get // corresponds to/formform target> attribute document. forms [I]. appendChild (oTag) // dynamically insert a control document. all. oDiv // reference layer oDivdocument. all. oDiv. style. display = "" // set the layer to a visual document. all. oDiv. style. display = "none" // set the layer to hide document. getElementId ("oDiv") // reference the object document through getElementId. getElementId ("oDiv "). style = "" document. getElementId ("oDiv "). display = "none"/* document. all indicates that the set of all objects in the document only supports this attribute by ie. Therefore, it is also used to determine the browser type */four attributes of the layer object document. getElementById ("ID "). innerText // dynamically output the text document. getElementById ("ID "). innerHTML // dynamically output HTMLdocument. getElementById ("ID "). outerText // same as innerTextdocument. getElementById ("ID "). outerHTML // same as innerHTML/* PCAS (select JS encapsulation class for Province, City, and region association of Province City Area Selector) Ver 2.01 Data Compression full version * \ production time: Update Time: data Correction: 2006-08-17 document size: 18KB demo address: http://www.popub.net/script/PCAS.html : http://www.popub.net/script/PCASClass.js Application Description: The page contains

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.