Summary of the attributes, methods, and events of JavaScript JavaServer Doc ument

Source: Internet
Author: User

Summary of the attributes, methods, and events of zookeeper Doc ument in javascript. if you need it, please refer to this article.

Attribute:

Attribute list of the Attributes storage node (read-only)
List of child nodes of the childNodes storage node (read-only)
DataType returns the Data Type of this node
Definition defines nodes in DTD or XML mode (read-only)
Doctype specifies the file type node (read-only)
DocumentElement returns the root element of the document (read/write)
FirstChild returns the first child node of the current node (read-only)
Implementation returns the XMLDOMImplementation object
LastChild returns the last child node of the current node (read-only)
NextSibling returns the next sibling node of the current node (read-only)
NodeName: return the node name (read-only)
NodeType return node type (read-only)
NodeTypedValue stores node values (read/write)
NodeValue returns the node text (read/write)
OwnerDocument returns the root document containing this node (read-only)
ParentNode returns the parent node (read-only)
Parsed: returns whether the node and Its subnodes have been Parsed (read-only)
Prefix returns the namespace Prefix (read-only)
PreserveWhiteSpace specifies whether to retain white space (read/write)
Previussibling returns the previous sibling node of this node (read-only)
Text returns the Text content of the node and its descendants (read/write)
Url returns the URL of the recently loaded XML document (read-only)
Xml returns the XML Representation of the node and its descendants (read-only)

Method:

AppendChild adds a new subnode to the current node, which is placed after the last subnode
CloneNode returns the copy of the current node
CreateAttribute
CreateCDATASection create CDATA segments that contain the given data
CreateComment create a comment Node
CreateDocumentFragment create a DocumentFragment object
CreateElement: Create an element node
CreateEntityReference: Create an EntityReference object
CreateNode creates nodes of the given type, name, and namespace.
CreatePorcessingInstruction
CreateTextNode: Create a text node that includes the given data
GetElementsByTagName returns the set of elements with the specified name.
HasChildNodes: returns whether the current node has subnodes.
InsertBefore inserts a subnode before a specified Node
Load import the XML document at the specified position
LoadXML import the XML document of the specified string
RemoveChild deletes a specified subnode from the subnode list.
ReplaceChild replaces the specified child node from the child node list
Save the XML file to the specified Node
SelectNodes matches the specified node and returns the list of matched nodes.
SelectSingleNode matches the specified node and returns the first matching node.
TransformNode converts nodes and their descendants using the specified style table.
TransformNodeToObject: Use the specified style sheet to convert nodes and their descendants to objects.

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 body>... /Body> text
Document. body. innerHTML // set body>... HTML code between/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 the 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

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 img tag on the corresponding page
Document. images. length // Number of img labels on the page
Document. images [0] // 1st img tags
Document. images [I] // I-1 img tag

B) direct reference through the nane attribute
Img name = "oImage"
Document. images. oImage // document. images. name attribute

C) reference the image's src attribute
Document. images. oImage. src // document. images. name attribute. src

D) create an image
Var oImage
OImage = new Image ()
Document.images.oimage.src000000001.jpg"
At the same time, you can create an img/tag on the page to display it.

------------------------

Forms set (forms in the page)

A) reference through a set
Document. forms // form tag on the corresponding page
Document. forms. length // Number of/formform labels on the page
Document. forms [0] // 1st/formform labels
Document. forms [I] // The I-1/formform tag
Document. forms [I]. length // number of controls in the I-1/formform
Document. forms [I]. elements [j] // The I-1 control in the J-1/formform

B) direct reference through the label name attribute
/Formform name = "Myform"> input name = "myctrl"/>/form
Document. Myform. myctrl // document. form name. Control name

C) Access Form attributes
Document. forms [I]. name // corresponding form name> attribute
Document. forms [I]. action // corresponding/formform action> attribute
Document. forms [I]. encoding // corresponding/formform enctype> attribute
Document.formspolici2.16.tar get // corresponding/formform target> attribute

Document. forms [I]. appendChild (oTag) // dynamically insert a control
Document. all. oDiv // reference layer oDiv
Document. all. oDiv. style. display = "// set the layer to visible.
Document. all. oDiv. style. display = "none" // The layers are hidden.
Document. getElementId ("oDiv") // reference an object through getElementId
Document. getElementId ("oDiv"). style ="
Document. getElementId ("oDiv"). display = "none"
/* Document. all indicates the set of all objects in the document.
Only ie supports this attribute, so it is also used to determine the browser type */

Four attributes of a layer object
Document. getElementById ("ID"). innerText // dynamic output text
Document. getElementById ("ID"). innerHTML // dynamically output HTML
Document. getElementById ("ID"). outerText // same as innerText
Document. getElementById ("ID"). outerHTML // same as innerHTML

The document attribute is created as a subobject of the window object and is used to access all elements on the page. It has the following application features:

Attribute/method/event Description
OnClick Triggered when a document is clicked
OnDblClick Triggered when the document is double-clicked
OnKeyDown Triggered when any key is pressed. Priority over onKeyPress event triggers
OnKeyPress See onKeyDown
OnKeyUp Triggered when the key is released
OnMouseDown Triggered when the mouse key is pressed
OnMouseUp Triggered when the mouse key is released
CaptureEvents () Capture all document-related events
Close () Close Document Stream
GetSelection () Returns the selected text.
HandleEvent () Call the event processor to specify the event
Open () Open Document Stream
ReleaseEvents () Release captured events
RouteEvent () Pass the captured event through a normal processing program
Write () Write content to the document
Writeln () Write a string with a line break in the document
AlinkColor Specify the alink attribute of the related tag
Anchors Array containing all the anchor labels in the document
BgColor Specifies the background color of the tag.
Cookie Cookie
Domain Specify the domain serving the document
Embeds An array containing all the embed labels in the document
FgColor Specify the text attribute of related labels
FormName Actual name of each form in the document
Forms An array containing all form labels in the document
Images An array containing all image labels in the document
LastModified Date of last modification to the document
Layers An array containing all the tags of the layer in the document
LinkColor Link attribute of related tags
Links Contains all links arrays in the document
Plugins Contains all plug-in arrays in the document
Referrer Specify the referral URL.
Title Title text
URL URL of the specified document
VlinkColor Specify the vlink attribute of the related tag

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.