What is nodeValue Property in JavaScript HTML DOM

Vikyath Ram
Updated on 22-May-2020 11:15:51

306 Views

The nodeValue property is used to get the node value. You need to specify the node.ExampleYou can try to run the following code to learn how to get nodeValue property.Live Demo           Get the node value       Demo Button Text                var val = document.getElementsByTagName("BUTTON")[0];          var res = val.childNodes[0].nodeValue;          document.write("Node Value: "+res);          

What is nodeName Property in JavaScript HTML DOM

Samual Sam
Updated on 22-May-2020 11:15:12

223 Views

The nodeName property in JavaScript is used to specify the name of a node.ExampleYou can try to run the following code to learn how to implement a nodeName property in JavaScript.Live Demo           Tutorials       Demo Content                            document.getElementById("id3").innerHTML = document.getElementById("id1").nodeName;          document.getElementById("id4").innerHTML = document.getElementById("id2").nodeName;          

Usage of onfocus Event in JavaScript

Govinda Sai
Updated on 22-May-2020 11:12:41

609 Views

The onfocus event is triggered when element gets focus. You can try to run the following code to learn how to implement onfocus event in JavaScript.Example           Write below:                      function newFunc(x) {             x.style.background = "blue";          }          

Usage of onblur Event in JavaScript

Nishtha Thakur
Updated on 22-May-2020 11:11:53

891 Views

The blur event triggers when object lose focus. You can try to run the following code to learn how to implement onblur event in JavaScript.Example           Write below:                      function newFunc(a) {             a.style.background = "green";          }          

Usage of onunload Event in JavaScript

Sai Nath
Updated on 21-May-2020 07:51:06

378 Views

The unload event trigger when you unload (or refresh) a page. You can try to run the following code to learn how to implement onunload event in JavaScript.Example           Close the page and see what happens!       This event may give unexpected results.                function newFunc() {             alert("Thank you!");          }          

Work with Document Title in JavaScript

Lakshmi Srinivas
Updated on 21-May-2020 07:49:29

328 Views

Use the document.title property to set the title of the document in JavaScript.ExampleYou can try to run the following code to implement document.title property in JavaScript.Live Demo           Demo Title                        var x = document.title;          document.write("Our Title: "+x);          

Usage of onresize Event in JavaScript

Ramu Prasad
Updated on 21-May-2020 07:48:58

281 Views

The resize event is triggered when the window is resized. Use window.outerWidth and window.outerHeight event in JavaScript to get the size of windows when the browser is resized.ExampleYou can try to run the following code to work with an onresize event in JavaScript.                    function resizeFunction() {             var val = "Window Width=" + window.outerWidth + ", Window Height=" + window.outerHeight;             document.getElementById("test").innerHTML = val;          }                     Resize browser window and check the window (browser window) height and width again.                

Usage of onscroll Event in JavaScript

Anvi Jain
Updated on 21-May-2020 07:48:28

219 Views

The onscroll event occurs when scrollbar is being scrolled for an element. You can try to run the following code to learn how to implement onscroll event in JavaScript.Example                    div {             border: 2px solid blue;             width: 300px;             height: 100px;             overflow: scroll;          }                                  This is ... Read More

Usage of onpagehide Event in JavaScript

Akshaya Akki
Updated on 21-May-2020 07:47:55

480 Views

The onpagehide event triggers in JavaScript when a user leaves the page and decides to move to another. Some examples include age refresh, a link is clicked, etc.ExampleYou can try the following code to learn how to implement onpagehide event in JavaScript.           Close the page and see what happens!                function newFunc() {             alert("Thank you!");          }          

Usage of the onbeforeunload Event in JavaScript

Sravani S
Updated on 21-May-2020 07:47:23

195 Views

If you want to trigger an event before the document is loaded, then use the onbeforeunload event.ExampleYou can try to run the following code to learn how to implement onbeforeunload event in JavaScript.           Click to open Qries                function myFunction() {             return "Working with onbeforeunload event";          }          

Advertisements