Found 2417 Articles for HTML

HTML DOM Italic Object

AmitDiwan
Updated on 30-Jul-2019 22:30:26

112 Views

The HTML DOM Italic Object represents an element which displays text in italic.SyntaxFollowing is the syntax −Creating an elementvar italicObject = document.createElement(“I”)ExampleLet us see an example for Italic object element − Live Demo Italic Object    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    } Italic Object Formatter:    var divDisplay = document.getElementById("divDisplay");    var textSelect = document.getElementById("textSelect");    function convertItalic() {       var italicObject = document.createElement("I");       var italicText = document.createTextNode(textSelect.value);       italicObject.appendChild(italicText);       divDisplay.appendChild(italicObject);    } OutputThis will produce the following output −Before clicking ‘Check’ button −After clicking ‘Check’ button −

HTML DOM isSameNode( ) Method

AmitDiwan
Updated on 30-Jul-2019 22:30:26

81 Views

The HTML DOM isSameNode() method returns a boolean value (true/false) if two nodes are same or not.Note − The isSameNode() method is deprecated so you should use ‘===’ operator instead.SyntaxFollowing is the syntax −Calling isSameNode()nodeOne.isSameNode(NodeTwo)ExampleLet us see an example for isSameNode() method − Live Demo isSameNode()    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 isEqualNode( ) Method

AmitDiwan
Updated on 30-Jul-2019 22:30:26

50 Views

The HTML DOM isEqualNode() method returns a boolean value (true/false) if specified nodes are equal or not.SyntaxFollowing is the syntax −Calling isEqualNode()firstNode.isEqualNode(secondNode)NOTE − ‘firstNode’ and ‘secondNode’ are equal only if they have same type, attributes and attribute values. All childNodes if any should also be the same.ExampleLet us see an example for isEqualNode() method − Live Demo isEqualNode()    body{       width: 90%;       margin: 0 auto;    }    button{       border-radius:10px;       display:block;       margin:0 auto;    }    #authorJohn, #authorMaya{       border:1px solid ... Read More

HTML DOM isDefaultNamespace( ) Method

AmitDiwan
Updated on 30-Jul-2019 22:30:26

76 Views

The HTML DOM isDefaultNamespace() method returns a boolean value (true/false) if specified namespace is default or not.Note − An element node inherits the namespace of its parent node, therefore, all elements in an XHTML document has the namespaceURI "http://www.w3.org/1999/xhtml".SyntaxFollowing is the syntax −Calling isDefaultNamespace()document.documentElement.isDefaultNamespace("nameSpaceURI")ExampleLet us see an example for isDefaultNamespace() method − Live Demo isDefaultNamespace()    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    } ... Read More

HTML DOM isContentEditable Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

66 Views

The HTML DOM isContentEditable property returns whether the content of an element can be modified or not.SyntaxFollowing is the syntax −Returning boolean value - true/falseHTMLElementObject.isContentEditableBoolean ValuesHere, “booleanValue” is returned −booleanValueDetailstrueIt defines that the content of HTMLElementObject is editable.falseIt defines that the content of HTMLElementObject is not editable.ExampleLet us see an example for isContentEditableproperty − Live Demo isContentEditable    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: ... Read More

HTML DOM insertBefore( ) Method

AmitDiwan
Updated on 30-Jul-2019 22:30:26

102 Views

The HTML DOM insertBefore() method inserts a new node before an already existing child node.SyntaxFollowing is the syntax −Calling insertBefore() with parameters of positionString and textnode.insertBefore(newNode, existingNode)Here, parameters can be the following −ParametersparametersDescriptionnewNodeIt is the newly created child node which is to be appended at beginningexistingNodeIt is the already existing nodeExampleLet us see an example for InsertBefore() method − Live Demo insertBefore()    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] ... Read More

HTML DOM insertAdjacentText( ) Method

AmitDiwan
Updated on 30-Jul-2019 22:30:26

112 Views

The HTML DOM insertAdjacentText() method inserts text string at a specified position.SyntaxFollowing is the syntax −Calling insertAdjacentText() with parameters of positionString and textnode.insertAdjacentText(“positionString”, text)Position StringsHere, “positionString” can be the following −positionStringDescriptionafterbeginIt inserts text after the beginning of node elementafterendIt inserts text after the node elementbeforebeginIt inserts text before the node elementbeforeendIt inserts text before the end of node elementExampleLet us see an example for InsertAdjacentText() method − Live Demo insertAdjacentText()    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px; ... Read More

HTML DOM insertAdjacentHTML( ) Method

AmitDiwan
Updated on 30-Jul-2019 22:30:26

204 Views

The HTML DOM insertAdjacentHTML() method inserts text string as HTML at a specified position.SyntaxFollowing is the syntax −Calling insertAdjacentHTML() with parameters of positionString and HTML codenode.insertAdjacentHTML(“positionString”, “htmlString”)Position StringsHere, “positionString” can be the following −positionStringDescriptionafterbeginIt inserts htmlString after the beginning of node elementafterendIt inserts htmlString after the node elementbeforebeginIt inserts htmlString before the node elementbeforeendIt inserts htmlString before the end of node elementHtml Stringsand, “htmlString” can be the following −positionStringnew span or This is a new paragraphor any other valid html codeExampleLet us see an example for InsertAdjacentHTML() method − Live Demo insertAdjacentHTML()    form {       ... Read More

HTML DOM insertAdjacentElement( ) Method

AmitDiwan
Updated on 30-Jul-2019 22:30:26

155 Views

The HTML DOM insertAdjacentElement() method inserts an element at a specified position.SyntaxFollowing is the syntax −Calling insertAdjacentElement() with parameters of positionString and elementnode.insertAdjacentElement(“positionString”, element)Position StringsHere, “positionString” can be the following −positionStringDescriptionafterbeginIt inserts element after the beginning of node elementafterendIt inserts element after the node elementbeforebeginIt inserts element before the node elementbeforeendIt inserts element before the end of node elementExampleLet us see an example for InsertAdjacentElement() method − Live Demo   insertAdjacentElement()    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: ... Read More

HTML DOM ins dateTime Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

63 Views

The HTML DOM ins dateTime property returns the date and time for when the text was inserted.SyntaxFollowing is the syntax −Returning string valueinsObject.dateTimeExampleLet us see an example for ins dateTime property − Live Demo ins dateTime    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    } ins-dateTime Fact: Water cannot persist on moon's surface. Water ice found on ... Read More

Advertisements