Found 2202 Articles for HTML

HTML DOM fullscreenElement property

AmitDiwan
Updated on 18-Feb-2021 09:18:18

149 Views

The HTML DOM fullscreenElement property is used for returning the element that is currently displayed in full screen mode. It will return null if the given element in not in fullscreen.SyntaxFollowing is the syntax for fullscreenElement property −document.fullscreenElementLet us look at an example of the fullscreenElement property −Note − This example only has standard syntax and browser prefix for Chrome, Safari and Opera. For your browser prefix, check the last section.ExampleLet us see an example −    function FullscreenEle() {       console.log(document.fullscreenElement || /*Standard Syntax*/       document.webkitFullscreenElement); /*For Chrome, Safari and Opera*/   ... Read More

HTML DOM Form target property

AmitDiwan
Updated on 20-Aug-2019 07:00:30

269 Views

The HTML DOM Form target property is used for specifiying where the response should be displayed after the form data has been submitted. It could display in a new tab, current tab or a new window. The form target property set or gets the target attribute value.SyntaxFollowing is the syntax for −Setting the target property −formObject.target = "_blank|_self|_parent|_top|framename"Here, _blank will open the response in new window, _self will open the response in the same window; parent will open in the parent frame, _top will open in full window body and framename will open it in a specified named frame.ExampleLet us ... Read More

HTML DOM Form submit() method

AmitDiwan
Updated on 20-Nov-2023 12:33:44

1K+ Views

The HTML DOM Form submit() method is used for submitting the form data to the address specified by the action attribute. It acts as a submit button to submit form data and it doesn’t take any kind of parameters.SyntaxFollowing is the syntax for Form submit() method −formObject.submit()ExampleLet us look at an example for the Form submit() method −    form{       border:2px solid blue;       margin:2px;       padding:4px;    }    function ResetForm() {       document.getElementById("FORM1").reset();       document.getElementById("Sample").innerHTML="Form has been reset";    } ... Read More

HTML DOM Form reset() method

AmitDiwan
Updated on 18-Nov-2023 03:35:42

1K+ Views

The HTML DOM Form reset() method is used for resetting all the values of the form elements and displaying the default values that are specified using the value attribute of the form elements. It acts as a reset button to clear form data and it doesn’t take any kind of parameters. Syntax Following is the syntax for form reset() method − formObject.reset() Example Let us look at an example of the Form reset() method −    form{       border:2px solid blue;       margin:2px;       padding:4px;    } ... Read More

HTML DOM Strong object

AmitDiwan
Updated on 19-Feb-2021 05:14:51

228 Views

The HTML DOM Strong object is associated with the HTML element. The strong tag is used for strong emphasis and makes the text bold. We can create and access strong element using the createElement() and getElementById() method respectively.SyntaxFollowing is the syntax for −Creating a strong object −Var s= document.createElement("STRONG");ExampleLet us look at an example for the strong object −Live Demo Strong object example Create a strong element by clicking the below button CREATE This is some text inside the p element    function createStrong() {       var s = document.createElement("STRONG");       var ... Read More

HTML DOM Storage setItem() method

AmitDiwan
Updated on 19-Feb-2021 05:16:28

131 Views

The HTML DOM Storage setItem() method is used for removing a storage object item by passing a given key name.SyntaxFollowing is the syntax for Storage removeItem() method −localStorage.removeItem(keyname, value);ORsessionStorage.removeItem(keyname, value );Here, keyname is of type string and represents the key name used for getting the value. The second parameter value represents the new value that will replace the old value.ExampleLet us look at the example for the Storage setItem() method −Live Demo Storage setItem() method example Create the localstorage item by clicking the below button CREATE Display the localstorage item by clicking the below button DISPLAY ... Read More

HTML DOM Storage removeItem() method

AmitDiwan
Updated on 20-Aug-2019 06:05:15

143 Views

The HTML DOM Storage removeItem() method is used for removing a storage object item by passing a given key name.SyntaxFollowing is the syntax for Storage removeItem() method −localStorage.removeItem(keyname);ORsessionStorage.removeItem(keyname);Here, keyname is of type string and represents the name of the item to be removed.ExampleLet us look at the example for the Storage removeItem() method − Storage removeItem() method example Delete the localstorage item by clicking the below button DISPLAY    localStorage.setItem("TEXT1", "HELLO WORLD");    function itemDelete() {       localStorage.removeItem("TEXT1");       itemShow();    }    function itemShow() {       var x = ... Read More

HTML DOM Storage length property

AmitDiwan
Updated on 19-Feb-2021 05:18:43

168 Views

The HTML DOM Storage length property is used for getting the number of items that are present inside the browser’s storage object. The storage object can be a localStorage object or a sessionStorage object.SyntaxFollowing is the syntax for −Storage length property using localStorage object −localStorage.length;Storage length property using sessionStorage objectsessionStorage.length;ExampleLet us look at the example for the Storage length property −Live Demo Storage length property example Get how many storage items are stored in the local storage object by clicking the below button GET NUMBER    function itemNum() {       var num = localStorage.length; ... Read More

HTML DOM Storage key() method

AmitDiwan
Updated on 20-Aug-2019 05:59:38

146 Views

The HTML DOM Storage key() method is used for returning the key name at a given index in a storage object. The index is passed as a parameter to key() method. The storage object can be a session object or localStorage object.SyntaxFollowing is the syntax for −Storage key() method using localStorage −localStorage.key(index);Storage key() method using sessionStorage −sessionStorage.key(index);Here, index is of type integer representing the key number that you want to get the name for.ExampleLet us look at the example for the Storage key() method − storage key() method example Get the first object key name by clicking on ... Read More

HTML DOM Storage getItem() method

AmitDiwan
Updated on 19-Feb-2021 05:21:20

130 Views

The HTML DOM Storage getItem() method is used for obtaining a storage object by passing a given key name. It will return the key’s values and if there is no key with that given name then NULL will be returned.SyntaxFollowing is the syntax for Storage getItem() method −localStorage.getItem(keyname);ORsessionStorage.getItem(keyname);Here, keyname is of type string and represents the name of the item to be obtained.ExampleLet us look at an example for the HTML DOM Storage getItem() method −Live Demo Storage getItem() method example Create a localStorage item with the name CLICKS to count the number of clicks on the create ... Read More

Advertisements