Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Javascript Articles - Page 581 of 671
204 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
466 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!"); }
183 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"; }
208 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!"); }
185 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!"); }
9K+ 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
579 Views
The scrollX property in JavaScript works the same as pageXoffset property. If you want to get the pixels the document scrolled to from the upper left corner of the window, then use the scrollX property for horizontal pixels.ExampleYou can try to run the following code to learn how to work with scrollX property in JavaScript. div { background-color: yellow; height: 1500px; width: 1500px; } function scrollFunc() { window.scrollBy(200, 200); alert("Horizontal: " + window.scrollX); } Scroll
389 Views
The scrollY property in JavaScript works the same as pageYoffset property. If you want to get the pixels the document scrolled to from the upper left corner of the window, then use the scrollY property for vertical pixels.ExampleYou can try to run the following code to learn how to work with scrollY property in JavaScript. div { background-color: yellow; height: 1500px; width: 1500px; } function scrollFunc() { window.scrollBy(200, 200); alert("Vertical: " + window.scrollY); } Scroll
430 Views
In this tutorial, we will discuss how we can return the pixel depth of the screen in JavaScript. There is a property in JavaScript name pixel depth with the help of this property we can quickly return the pixel depth of the screen’s color. This pixel depth property returns the screen’s color depth in bits per pixel, and this property is read-only means (A property's value can be accessed, but it cannot be given a value. or we could state that it cannot be assigned to or overwritten). Basically, we are returning how many bits are used to store a ... Read More
