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
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
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
The HTML DOM Video load() is used for re-rendering of video element after its certain attributes get updated by user such as ‘src’.SyntaxFollowing is the syntax −videoObject.load()Let us see an example of Video load() property −ExampleLive Demo HTML DOM Video load() * { padding: 2px; margin:5px; } form { width:70%; margin: 0 auto; text-align: center; } input[type="button"] { border-radius: 10px; } ... Read More
The HTML DOM Video loop property returns/sets boolean value corresponding to whether the video will play again automatically on end or not.SyntaxFollowing is the syntax −Returning boolean value - true/falsemediaObject.loopSetting loop to booleanValuemediaObject.loop = booleanValueHere, “booleanValue” can be the following −booleanValueDetailstrueIt defines that video willautomatically play again on endfalseIt defines that video won’tautomatically play again on endLet us see an example of Video loop property −ExampleLive Demo HTML DOM Video loop * { padding: 2px; margin:5px; } form { width:70%; margin: 0 ... Read More
The HTML DOM Video muted property returns/sets boolean value corresponding to whether the video’s audio will be on mute or not.syntaxFollowing is the syntax −Returning boolean value - true/falsemediaObject.mutedSetting muted to booleanValuemediaObject.muted = booleanValueHere, “booleanValue” can be the following −booleanValueDetailstrueIt defines that video willhave its audio on mutefalseIt defines that video willnot have its audio on muteLet us see an example of Video muted property −ExampleLive Demo HTML DOM Video muted * { padding: 2px; margin:5px; } form { width:70%; margin: 0 ... Read More
The HTML DOM Video networkState property returns a number corresponding to the network state of the video.SyntaxFollowing is the syntax −Returning number valuemediaObject.networkStateHere, the return value can be the following −0 (NETWORK_EMPTY) depicts media has not yet been initialized1 (NETWORK_IDLE) depicts media is active and has selected a resource, but is not using the network2 (NETWORK_LOADING) depicts browser is downloading media data3 (NETWORK_NO_SOURCE) depicts no media source foundLet us see an example of HTML DOM Video networkState property −ExampleLive Demo HTML DOM Video networkState * { padding: 2px; margin:5px; ... Read More
The HTML DOM Video paused property returns a boolean (true/false) corresponding to whether the video is playing or not.SyntaxFollowing is the syntax −Returning boolean valuemediaObject.pausedLet us see an example of HTML DOM Video paused property −ExampleLive Demo HTML DOM Video paused * { padding: 2px; margin:5px; } form { width:70%; margin: 0 auto; text-align: center; } input[type="button"] { border-radius: 10px; } .dimLight { background-color: #000; } ... Read More
The HTML DOM Video play() is used for playing the current media content and to stopping media use pause().SyntaxFollowing is the syntax −videoObject.play()Let us see an example of Video play() property −ExampleLive Demo HTML DOM Video play() * { padding: 2px; margin:5px; } form { width:70%; margin: 0 auto; text-align: center; } input[type="button"] { border-radius: 10px; } HTML-DOM-Video-play( ) var divDisplay = document.getElementById("divDisplay"); var demo = document.getElementById("demo"); function setControls(val) { if(val === 1){ demo.play(); divDisplay.textContent = 'Video is playing'; } else{ demo.pause(); divDisplay.textContent = 'Video is paused'; } } OutputClicking ‘Play’ button −Clicking ‘Pause’ button −
The HTML DOM Video playbackRate property returns/sets a number corrosponding to current playback rate of media.SyntaxFollowing is the syntax −Returning playbackRate as a numbermediaObject.playbackRateSetting playbackRate to a numbermediaObject.playbackRate = numberNOTE − Number has a max value of ‘16’ and if ‘0.0’ video is still.Let us see an example of Video playbackRate property −ExampleLive Demo HTML DOM Video playbackRate * { padding: 2px; margin:5px; } form { width:70%; margin: 0 auto; text-align: center; } input[type="button"] { ... Read More