HTML DOM Object data Property

AmitDiwan
Updated on 25-Oct-2019 08:12:24

75 Views

The HTML DOM Object data property returns a string corresponding to the value of the attribute data.Following is the syntax −Returning string valueObjectElement.dataSet data property to a string valueObjectElement.data = URLStringLet us see an example of HTML DOM Object data property −Example Live Demo HTML DOM Object data    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    }                    HTML-DOM-Object-data                                                          var divDisplay = document.getElementById("divDisplay");    var objSelect = document.getElementById("objSelect");    function getObjectData() {       objSelect.data       divDisplay.textContent = 'URL of above picture: '+objSelect.data;    } OutputBefore clicking ‘Get URL’ button −After clicking ‘Get URL’ button −

HTML DOM normalize( ) Method

AmitDiwan
Updated on 25-Oct-2019 08:07:35

107 Views

The HTML DOM normalize() method removes empty Text Nodes, and joins adjacent Text Nodes from a specified node.Following is the syntax −Calling normalize()document.normalize()Let us see an example of normalize() method −Example Live Demo HTML DOM normalize()    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    }                    HTML-DOM-normalize( )       ... Read More

HTML DOM nodeValue Property

AmitDiwan
Updated on 25-Oct-2019 07:59:35

170 Views

The HTML DOM nodeValue property returns/sets a string corresponding to the value of the node.Following is the syntax −Returning string valueNode.nodeValueHere, the return value can be the following −Value as ‘null’ for document nodes & element nodesValue as ‘value’ of the attribute for attribute nodesValue as content for text nodes and comment nodesSet nodeValue to a string valueNode.nodeValue = stringNOTE: Whitespaces are considered as text nodes only.Let us see an example of HTML DOM nodeValue property −Example Live Demo HTML DOM nodeValue    form {       width:70%;       margin: 0 auto;       ... Read More

HTML DOM nodeType Property

AmitDiwan
Updated on 25-Oct-2019 07:50:55

84 Views

The HTML DOM nodeType property returns a number corresponding to the type of the node.Following is the syntax −Returning number valueNode.nodeTypeHere, the return value can be the following −Number ‘1’ for element nodesNumber ‘2’ for attribute nodesNumber ‘3’ for text nodesNumber ‘8’ for comment nodesNOTE: Whitespaces are considered as text nodes only.Let us see an example of HTML DOM nodeType property −Example Live Demo HTML DOM nodeType    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       ... Read More

HTML DOM nodeName Property

AmitDiwan
Updated on 25-Oct-2019 07:48:01

105 Views

The HTML DOM nodeName property returns a string corresponding to the name of the node.Following is the syntax −Returning string valueNode.nodeNameHere, the return value can be the following −Tag name in uppercase for element nodesName of the attribute for attribute nodes‘#comment’ for comment nodes‘#document’ for comment nodes‘#text’ for text nodesNOTE: Whitespaces are considered as text nodes only.Let us see an example of HTML DOM nodeName property −Example Live Demo HTML DOM nodeName    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       ... Read More

HTML DOM nextSibling Property

AmitDiwan
Updated on 25-Oct-2019 07:44:46

151 Views

The HTML DOM nextSibling property returns the element node which is immediately following specified element node.NOTE: This property does not ignore text and comment nodes.Following is the syntax −Returning nextSibling nodenodeList.nextSiblingLet us see an example of HTML DOM nextSibling property −Example Live Demo HTML DOM nextSibling    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    }    ul{       width: 30%;   ... Read More

HTML DOM nextElementSibling Property

AmitDiwan
Updated on 25-Oct-2019 07:39:20

108 Views

The HTML DOM nextElementSibling property returns the element node which is immediately following specified element node.NOTE: This property does ignore text and comment nodes.Following is the syntax −Returning nextElementSibling nodenodeList.nextElementSiblingLet us see an example of HTML DOM nextElementSibling property −Example Live Demo HTML DOM nextElementSibling    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    }    ul{       width: 30%;     ... Read More

HTML DOM Nav Object

AmitDiwan
Updated on 25-Oct-2019 07:34:16

180 Views

The HTML DOM Nav Object in HTML represents a element.Let us see an example of HTML DOM Nav object −Example Live Demo HTML DOM Nav    * {       padding: 2px;       margin:5px;    }       form {       width:70%;       margin: 0 auto;       text-align: center;    }    input[type="button"] {       border-radius: 10px;    }                    HTML-DOM-Nav                         ... Read More

HTML DOM name Property

AmitDiwan
Updated on 25-Oct-2019 07:26:33

125 Views

The HTML DOM name property returns a string corresponding to the name of the attribute of an element.Following is the syntax −Returning string valueelementAttribute.nameLet us see an example of HTML DOM name property − Live Demo HTML DOM name    * {       padding: 2px;       margin:5px;    }    form {       width:70%;       margin: 0 auto;       text-align: center;    }    input[type="button"] {       border-radius: 10px;    }                    HTML-DOM-name   ... Read More

HTML DOM MouseEvent Object

AmitDiwan
Updated on 25-Oct-2019 07:20:32

351 Views

The HTML DOM MouseEvent Object represents an event which incurs on interaction of mouse with the HTML document elements.Here, “MouseEvent” can have the following properties and methods −Property/MethodDescriptionaltKeyItreturns whether the "ALT" key on keyboard was pressedwhen the mouse event was triggeredbuttonItreturns a number corresponding to which mouse button was pressedwhen the mouse event was triggeredbuttonsItreturns which mouse buttons were pressed when the mouse event wastriggeredclientXItreturns the horizontal (x) coordinate of the mouse pointer, relative to the current window, when the mouse event was triggeredclientYItreturns the vertical (y) coordinate of the mouse pointer, relativeto the current window, when the mouse event ... Read More

Advertisements