Found 10483 Articles for Web Development

HTML DOM Location hash Property

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

216 Views

The Location hash property returns/appends a string value (anchor part) to a URL. Anchor part is prefixed with ‘#’ automatically and then appended.SyntaxFollowing is the syntax −Returning value of the hash propertylocation.hashValue of the hash property setlocation.hash = ‘string’ExampleLet us see an example for Location hash property − Live Demo Location hash    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    } ... Read More

HTML DOM Local Storage clear() method

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

292 Views

The HTML DOM Local Storage clear() method is used for clearing the whole local storage entries.SyntaxFollowing is the syntax −localStorage.clear()OrsessionStorage.clear()ExampleLet us see an example for LocalStorage() method property − Live Demo LocalStorage clear()    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    }    table, th, td {       border:1px solid black;       border-collapse: collapse;       margin: 0 ... Read More

HTML DOM links Collection

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

191 Views

The links Collection returns a list/collection of all the links corresponding to and/or elements.SyntaxFollowing is the syntax −Returning links collectiondocument.linksPropertiesHere, “links” collection can have the following properties and methods −Property/MethodDescriptionlengthIt returns the number of  and  elementsnamedItem()It returns the  or/and  element with the specified idExampleLet us see an example for links collection length property − Live Demo Links Collection length    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {   ... Read More

HTML DOM Link type Property

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

131 Views

The Link type property sets/returns the type of a linked document.SyntaxFollowing is the syntax −Returning type attribute valuelinkObject.typeSetting type to a valid valuelinkObject.type = valueNOTE  − valid values include "text/javascript", "text/css", "image/gif", etc.ExampleLet us see an example for Link type property − Link type Link-type    var divDisplay = document.getElementById("divDisplay");    var extStyle = document.getElementById("extStyle");    divDisplay.textContent = 'The linked document type: '+extStyle.type+' is not compatible';    function correctType(){       extStyle.type = 'text/css';       divDisplay.textContent = 'Congrats! The linked document type: '+extStyle.type+' is compatible'; ... Read More

HTML DOM Link sizes Property

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

169 Views

The HTML DOM Link sizes property returns the value of the sizes attribute of link element.NOTE − The sizes property is used only when rel property is set to ‘icon’SyntaxFollowing is the syntax −Returning sizes attribute valuelinkObject.sizesExampleLet us see an example for Link rel property − Live Demo Link sizes Link-sizes    var divDisplay = document.getElementById("divDisplay");    var extStyle = document.getElementById("extStyle");    if(extStyle.sizes == '10x10')       divDisplay.textContent = 'The linked icon size: '+extStyle.sizes+' is not compatible';    else       divDisplay.textContent = 'Congrats! The linked icon size is ... Read More

HTML DOM Link rel Property

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

137 Views

The HTML DOM Link rel property sets/returns the relationship between the current and the linked document and is required to mention.SyntaxFollowing is the syntax −Returning rel attribute valuelinkObject.relSetting rel to a valueStringlinkObject.rel = valueStringValue StringsHere, “valueString” can be the following −valueStringDescriptionalternateIt providesauthorIt provides a link to the author of the linked documentdnsprefetchIt specifies that the browser should pre-emptively perform DNS resolution for the target resource's originhelpIt provides a link to a help document if anyiconIt imports an icon to represent the documentrelIt sets/returns the relationship between the current and the linked documentlicenseIt provides copyright information for the linked documentnextIt provides ... Read More

HTML DOM Link Object

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

299 Views

The HTML DOM Link Object in HTML represents the element.SyntaxFollowing is the syntax −Creating a elementvar linkObject = document.createElement(“LINK”)propertiesHere, “LinkObject” can have the following properties −PropertyDescriptioncrossOriginIt sets/returns the the CORS settings of the linked documentdisabledIt sets/returns whether the linked document is disabled, or nothrefIt sets/returns the URL of the linked documenthreflangIt sets/returns the language code of the linked documentmediaIt sets/returns the media type for the link element tagrelIt sets/returns the relationship between the current and the linked documentsizesIt returns the value of the sizes attribute of the linked documenttypeIt sets/returns the content type of the linked documentExampleLet us ... Read More

HTML DOM Link hreflang Property

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

130 Views

The Link hreflang property sets/returns the language code of a linked document.SyntaxFollowing is the syntax −Returning hreflang attribute valuelinkObject.hreflangSetting hreflang to a language codelinkObject.hreflang = langCodeExampleLet us see an example for Link hreflang property − Live Demo Link hreflang Link-hreflang Spanish    var divDisplay = document.getElementById("divDisplay");    var extStyle = document.getElementById("extStyle");    function changeStyle(){       if(extStyle.hreflang === 'en'){          divDisplay.textContent = 'The linked document is written in english';          document.getElementsByTagName('h3')[0].textContent = 'English'       }    } In ... Read More

HTML DOM Link href Property

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

268 Views

The HTML DOM Link href property sets/returns the path/url of a linked document. −SyntaxFollowing is the syntax −Returning href attribute valuelinkObject.hrefSetting href to a stringlinkObject.href = stringBoolean ValuesHere, “string” can be the following −booleanValueDetailspathIt defines the absolute/relative path to a document.urlIt defines the url address of the document to be linked.ExampleLet us see an example for Link href property − Link href Link-href Sales Target Week:    var divDisplay = document.getElementById("divDisplay");    var inputWeek = document.getElementById("WeekSelect");    var extStyle = document.getElementById("extStyle");    divDisplay.textContent = 'Week ... Read More

HTML DOM Link disabled Property

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

143 Views

The HTML DOM Link disabled property sets/returns whether element is enabled or disabled.SyntaxFollowing is the syntax −Returning boolean value - true/falselinkObject.disabledSetting disabled to booleanValuelinkObject.disabled = booleanValueBoolean ValuesHere, “booleanValue” can be the following −booleanValueDetailstrueIt defines that the is disabled.falseIt defines that the is not disabled and it is also the default value.ExampleLet us see an example for Link disabled property − Live Demo Link Disabled Link-disabled Sales Target Week:    var divDisplay = document.getElementById("divDisplay");    var inputWeek = document.getElementById("WeekSelect");    var extStyle = document.getElementById("extStyle");    divDisplay.textContent ... Read More

Advertisements