Programming Scripts Articles

Page 23 of 33

What is the usage of onsearch event in JavaScript?

Abhinanda Shri
Abhinanda Shri
Updated on 22-May-2020 404 Views

The onsearch event is useful for search i.e. a user press ENTER or “x” key in input element. The type for is search, since it is for users to search. The onsearch event isn’t supported in Internet Explorer, Firefox, and Opera.ExampleYou can try to run the following code to learn how to implement onsearch event in JavaScript.           Write what you want to search below and press "ENTER".                      function searchFunc() {             var a = document.getElementById("newInput");             document.write("Searched = " + a.value);          }          

Read More

What is the usage of oninvalid event in JavaScript?

Smita Kapse
Smita Kapse
Updated on 22-May-2020 322 Views

The oninvalid event is triggered if the field value added in is invalid. Add a message if the user forgets to fill the form before submission.ExampleYou can try to run the following code to learn how to implement oninvalid event in JavaScript.                    function resetFunct() {             alert("The form was reset");          }                              Enter Name:            Enter birth month:                              

Read More

What is the usage of onfocus event in JavaScript?

Govinda Sai
Govinda Sai
Updated on 22-May-2020 633 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";          }          

Read More

What is the usage of onblur event in JavaScript?

Nishtha Thakur
Nishtha Thakur
Updated on 22-May-2020 925 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";          }          

Read More

What is the usage of onunload event in JavaScript?

Sai Nath
Sai Nath
Updated on 21-May-2020 402 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!");          }          

Read More

What is the usage of onscroll event in JavaScript?

Anvi Jain
Anvi Jain
Updated on 21-May-2020 232 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
Akshaya Akki
Updated on 21-May-2020 501 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!");          }          

Read More

What is the usage of the onbeforeunload event in JavaScript?

Sravani S
Sravani S
Updated on 21-May-2020 210 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";          }          

Read More

What is the usage of onpageshow event in JavaScript?

Nitya Raut
Nitya Raut
Updated on 21-May-2020 237 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!");          }          

Read More

What is the usage of onhashchange event in JavaScript?

Anjana
Anjana
Updated on 21-May-2020 213 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!");          }          

Read More
Showing 221–230 of 328 articles
« Prev 1 21 22 23 24 25 33 Next »
Advertisements