Found 2202 Articles for HTML

HTML DOM Input Number value Property

AmitDiwan
Updated on 19-Feb-2021 09:10:08

386 Views

The HTML DOM Input number value property is associated with the input element having type=”Number” and having the value attribute. This property is used for returning the value of input element value attribute or to set it. This property is used for specifying a default value for elements and it also changes its value to user input.SyntaxFollowing is the syntax for −Setting the value property −numberObject.value = number;Here, number is used for specifying the value for the number field.ExampleLet us look at an example for the input Number value property −Live Demo Input Number Value property PHONE NO: ... Read More

HTML DOM Input Number type Property

AmitDiwan
Updated on 19-Feb-2021 09:11:44

236 Views

The HTML DOM Input number type property is associated with the input element having its type=”number”. It will always return number for the input number element.SyntaxFollowing is the syntax for number type property −numberObject.typeExampleLet us look at an example for the HTML DOM Input Number type property −Live Demo Input Number type property PHONE NO: Get the above element type by clicking the below button Get Type    function getType() {       var t = document.getElementById("NUMBER1").type;       document.getElementById("Sample").innerHTML = "The type for the input field is : "+t;    } ... Read More

HTML DOM Heading object

AmitDiwan
Updated on 19-Feb-2021 09:15:01

518 Views

The HTML DOM Heading object is associated with the HTML heading elements ranging from to . Using the heading object we can create and access heading element with the createElement() and getElementById() method respectively.SyntaxFollowing is the syntax for −Creating a Heading object −var p = document.createElement("H1");ExampleLet us look at an example for the Heading object −Live Demo Heading object example Create a h1 element by clicking the below button CREATE    function createH1() {       var h = document.createElement("H1");       var txt = document.createTextNode("H1 element has been created");       h.appendChild(txt); ... Read More

HTML DOM header object

AmitDiwan
Updated on 19-Feb-2021 09:16:25

2K+ Views

The HTML DOM header object is associated with the HTML element that introduced in HTML 5. Using the header object we can create and access element using the createElement() and getElementById() method respectively.SyntaxFollowing is the syntax for −Creating a header object −var p = document.createElement("HEADER");ExampleLet us look at an example for the HTML DOM header object −Live Demo Header object example Create a header element by clicking the below button CREATE    function headerCreate() {       var h = document.createElement("HEADER");       document.body.appendChild(h);       var h2 = document.createElement("H2");     ... Read More

HTML DOM HashChangeEvent

AmitDiwan
Updated on 19-Feb-2021 09:17:50

155 Views

The HTML DOM HashChangeEvent is a type of interface used for representing those events that fire whenever the # part of the URL has been modified.PropertiesFollowing are the properties for the HashChangeEvent −PropertyDescriptionnewURLTo return the document URL after the hash has been modified.oldURLTo returns the document URL before the hash was changedSyntaxFollowing is the syntax for HashChangeEvent.event.eventPropertyHere, eventProperty is one of the above two properties.ExampleLet us look at an example for the HashChangeEvent.Live Demo HashChangeEvent example Change the hash by clicking the below button CHANGE    function changeHash() {       location.hash = "NEWHASH";   ... Read More

HTML DOM getNamedItem() method

AmitDiwan
Updated on 19-Feb-2021 09:25:22

191 Views

The HTML DOM getNamedItem() method is used for getting the attribute node with a given name as a NamedNodeMap object. To get that specific attribute node we have to call this method only upon the attributes property since the attribute property returns a list from which we can filter a specific attribute using getNamedItem() method.SyntaxFollowing is the syntax for the getNamedItem() method −namednodemap.getNamedItem(nodename)Here, nodename is a mandatory parameter value of type string indicating the name of the node present in the namedNodeMap.ExampleLet us look at an example for the getNamedItem() method −Live Demo getNamedItem() example USERNAME: ... Read More

HTML DOM Geolocation position property

AmitDiwan
Updated on 18-Jun-2020 08:59:53

189 Views

The HTML DOM Geolocation coordinates property is used for getting a user’s device position and altitude on earth. The user have to approve that he/she wants to give coordinates before this property could work. This is done so that users privacy isn’t compromised. This can be used for tracking various devices location.PropertiesFollowing is the position property −Note − The below properties are read-only −PropertyDescriptionposition.coordsTo return a coordinates object having information like latitude, longitude, altitude, and speed of the device on the earth. It also has an accuracy value describing how accurate the measurements are in meters.position.timestampTo representing the time and ... Read More

HTML DOM Form object

AmitDiwan
Updated on 20-Feb-2021 05:07:36

3K+ Views

The HTML DOM Form object is associated with the HTML element. We can create and access a form element using the createElement() and getElementById() method of the document object. We can set various properties of the form object and can get them too.PropertiesFollowing are the Form object properties −PropertyDescriptionacceptCharsetTo set or return the accept-charset attribute value in a form.ActionTo set or return the action attribute value of the formAutocompleteTo set or return the autocomplete attribute value of the form.EncodingIt is just an alias of enctype.EnctypeTo set or return the enctype attribute value of the form.LengthTo return how many elements ... Read More

HTML DOM Form name Property

AmitDiwan
Updated on 20-Feb-2021 05:09:07

287 Views

The HTML DOM Form name property is associated with the name attribute of the form element. The form name property is used for setting or getting the form name attribute value. The form name property gives the name to the form.SyntaxFollowing is the syntax for −Setting the form name −formObject.name = nameHere, the name specifies the name of the form.ExampleLet us look at an example of the Form name property −Live Demo    form {       border:2px solid blue;       margin:2px;       padding:4px;    }    function ChangeName() { ... Read More

HTML DOM DT object

AmitDiwan
Updated on 20-Feb-2021 05:13:35

91 Views

The HTML DOM DT object is associated with the HTML element.Using the DT object we can create the element dynamically using JavaScript.SyntaxFollowing is the syntax for −Creating a DT object −var p = document.createElement("DT");ExampleLet us look at an example for the HTML DOM DT object −Live Demo DT object example Create a DT element inside a DL by clicking the below button CREATE    function createDT() {       var Desc = document.createElement("DL");       var DesT = document.createElement("DT");       var tn= document.createTextNode("Mango");       DesT.appendChild(tn);       var ... Read More

Advertisements