Web Development Articles

Page 76 of 801

Execute a script when a mouse pointer moves over an element in HTML?

usharani
usharani
Updated on 16-Mar-2026 421 Views

The onmouseover attribute in HTML triggers when a mouse pointer moves over an element. This event is commonly used to create interactive effects such as changing colors, displaying tooltips, or showing additional content when users hover over elements. Syntax Following is the syntax for the onmouseover attribute − Content The script parameter contains JavaScript code that executes when the mouse pointer enters the element's area. Basic Onmouseover Example Following example demonstrates how to change text color when hovering over a heading − Onmouseover Example ...

Read More

Execute a script when the media is paused either by the user or programmatically in HTML?

George John
George John
Updated on 16-Mar-2026 217 Views

The onpause attribute in HTML is an event handler that triggers when a media element (audio or video) is paused, either by user interaction or programmatically through JavaScript. This attribute allows you to execute custom JavaScript functions when the media playback is paused. Syntax Following is the syntax for the onpause attribute − Following is the syntax for programmatic usage − element.onpause = function() { /* code */ }; Using onpause with Video Element The onpause attribute is commonly used with and ...

Read More

Execute a script when an element's scrollbar is being scrolled in HTML?

usharani
usharani
Updated on 16-Mar-2026 241 Views

When an element's scrollbar is being scrolled, the onscroll event attribute triggers and executes a specified JavaScript function. This event fires when the user scrolls within an element that has scrollable content, making it useful for creating interactive scroll-based behaviors. Syntax Following is the syntax for the onscroll event attribute − Content Alternatively, you can add the scroll event listener using JavaScript − element.addEventListener('scroll', functionName); How It Works The onscroll event fires whenever the scrollTop or scrollLeft property of an element changes due to user interaction. This includes scrolling ...

Read More

Execute a script when a reset button in a form is clicked in HTML?

Govinda Sai
Govinda Sai
Updated on 16-Mar-2026 294 Views

The onreset attribute in HTML is an event handler that executes a JavaScript function when a form's reset button is clicked. This attribute is applied to the element and triggers before the form fields are actually reset to their default values. Syntax Following is the syntax for using the onreset attribute − The onreset attribute calls the specified JavaScript function when the user clicks the reset button or programmatically resets the form. Basic Example Following example demonstrates how to execute a ...

Read More

Execute a script when the browser window is being resized in HTML?

Daniol Thomas
Daniol Thomas
Updated on 16-Mar-2026 339 Views

The onresize attribute in HTML executes a JavaScript function when the browser window is resized. This event is commonly used to adjust layouts, recalculate dimensions, or trigger responsive behavior when users change their window size. Syntax Following is the syntax for the onresize attribute − Content The onresize attribute is typically used on the element or object to detect when the entire browser window is resized. Using onresize with Alert Following example shows how to trigger an alert when the browser window is resized − ...

Read More

How to get the value associated with the http-equiv or name attribute in HTML?

Abhinanda Shri
Abhinanda Shri
Updated on 16-Mar-2026 202 Views

The content attribute in HTML is used to specify the value associated with the http-equiv or name attribute in meta tags. This attribute provides essential metadata information to browsers and search engines about your web page. Syntax Following is the syntax for using the content attribute with the name attribute − Following is the syntax for using the content attribute with the http-equiv attribute − Using Content with Name Attribute The name attribute specifies the type of metadata, while the content attribute provides the actual value. This ...

Read More

How to store custom data private to the page or application in HTML?

Yaswanth Varma
Yaswanth Varma
Updated on 16-Mar-2026 608 Views

HTML data-* attributes allow you to store custom data directly within HTML elements. These attributes provide a standardized way to embed application-specific information that can be accessed via JavaScript and CSS without interfering with HTML semantics. The data-* attributes are part of the HTML5 specification and offer a clean alternative to using non-standard attributes or hidden form fields for storing custom data. Any attribute name beginning with data- followed by at least one character is considered a valid data attribute. Syntax Following is the syntax for data-* attributes in HTML − Content The ...

Read More

Execute a script when the file is unavailable in HTML?

Arjun Thakur
Arjun Thakur
Updated on 16-Mar-2026 249 Views

The onemptied attribute in HTML is an event handler that executes JavaScript code when a media element (audio or video) becomes unavailable or empty. This event typically occurs when the media file cannot be loaded, the playlist becomes empty, or the media source is removed during playback. Syntax Following is the syntax for the onemptied attribute − The script parameter contains JavaScript code or a function call that executes when the emptied event is triggered. When the Emptied Event Occurs The emptied event is fired in the following scenarios − ...

Read More

Execute a script when the media has reached the end of HTML?

Giri Raju
Giri Raju
Updated on 16-Mar-2026 174 Views

The onended attribute in HTML executes a script when media playback reaches its natural end. This event is triggered for and elements when the media finishes playing, allowing you to display messages, suggest related content, or perform other actions. Syntax Following is the syntax for the onended attribute − ... ... The function() represents a JavaScript function that will execute when the media reaches its end. Video Element with onended Example Following example demonstrates the onended attribute with a video element − ...

Read More

Execute a script at the start of a drag operation in HTML?

Chandu yadav
Chandu yadav
Updated on 16-Mar-2026 168 Views

The ondragstart attribute in HTML executes a JavaScript function when a user begins dragging an element. This event is the first to fire in the HTML5 drag and drop sequence, allowing you to set up data transfer and configure the drag operation before the element starts moving. Syntax Following is the syntax for the ondragstart attribute − Content The ondragstart attribute accepts a JavaScript function that receives a DragEvent object containing information about the drag operation. How It Works When a drag operation begins, the ondragstart event fires immediately. This is typically ...

Read More
Showing 751–760 of 8,010 articles
« Prev 1 74 75 76 77 78 801 Next »
Advertisements