Found 2556 Articles for HTML

What is the usage of onblur event in JavaScript?

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

663 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";          }          

What is the usage of onunload event in JavaScript?

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

259 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!");          }          

How to work with document.title in JavaScript?

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

165 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);          

What is the usage of onresize event in JavaScript?

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

169 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.                

What is the usage of onscroll event in JavaScript?

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

135 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

What is the usage of onpagehide event in JavaScript?

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

281 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!");          }          

What is the usage of the onbeforeunload event in JavaScript?

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

102 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";          }          

What is the usage of onpageshow event in JavaScript?

Nitya Raut
Updated on 21-May-2020 07:46:57

144 Views

The onpageshow event triggers in JavaScript when a user reaches the new web page.ExampleYou can try to run the following code to learn how to implement onpageshow event in JavaScript.           On first visit, a welcome message is visible.                function newFunc() {             alert("Welcome!");          }          

What is the usage of onhashchange event in JavaScript?

Anjana
Updated on 21-May-2020 07:46:11

116 Views

When anchor part is changed, then the onhashchange event occurs. You can try to run the following code to learn how to implement onhashchange event in JavaScript.Example           Click to change anchor                function functionChange() {             location.hash = "about";             var hash = location.hash;             document.write("The anchor part is now: " + hash);          }          // If the achor part is changed          function newFunc() {             alert("Anchor part changed!");          }          

How to stop the execution of a function with JavaScript?

Jennifer Nicholas
Updated on 21-May-2020 07:45:40

8K+ Views

To stop the execution of a function in JavaScript, use the clearTimeout() method. This function call clears any timer set by the setTimeout() functions.ExampleYou can try to run the following code to learn how to work with clearTimeout() method in JavaScript.           JavaScript clearTimeout() method                                                        Click the buttons below to handle animation                              

Advertisements