Front End Technology Articles

Page 74 of 652

Execute a script when the media has started playing in HTML?

Ankith Reddy
Ankith Reddy
Updated on 16-Mar-2026 175 Views

The onplaying attribute in HTML is used to execute a JavaScript function when an audio or video element starts playing. This event is triggered after the media has been paused and is resumed, or when it starts playing for the first time. Syntax Following is the syntax for using the onplaying attribute − ... ... The onplaying attribute can also be used with JavaScript event listeners − element.addEventListener('playing', functionName); Using onplaying with Video Element Example Following example demonstrates how to execute a script when a video starts playing ...

Read More

Execute a script when the window's history changes in HTML?

Srinivas Gorla
Srinivas Gorla
Updated on 16-Mar-2026 220 Views

The onpopstate event in HTML triggers when the browser's history changes, such as when a user clicks the back or forward button. This event is essential for handling navigation in single-page applications and managing browser history programmatically. Syntax Following is the syntax for the onpopstate event − In JavaScript, you can also add the event listener programmatically − window.addEventListener('popstate', functionName); How It Works The onpopstate event fires when the active history entry changes. This happens when users navigate using browser buttons (back/forward) or when history.back(), history.forward(), or history.go() ...

Read More

Execute a script when a mouse button is released over an element in HTML?

radhakrishna
radhakrishna
Updated on 16-Mar-2026 285 Views

When a mouse button is released over an HTML element, the onmouseup event is triggered. This event is commonly used for creating interactive elements that respond to mouse clicks and releases. The onmouseup attribute can be added to any HTML element to execute JavaScript code when the user releases a mouse button while the cursor is over that element. Syntax Following is the syntax for the onmouseup event attribute − Content Where script is the JavaScript code that executes when the mouse button is released over the element. How It Works The ...

Read More

How do we create a footer for a document or section in HTML5?

Jennifer Nicholas
Jennifer Nicholas
Updated on 16-Mar-2026 378 Views

The HTML5 element represents a footer for a document or section. It typically contains authorship information, copyright notices, links to related documents, or other metadata. The footer provides semantic meaning to the content and helps screen readers and search engines understand the document structure. Syntax Following is the syntax for the HTML5 footer element − Footer content here The element can be used multiple times in a document. It can appear as a footer for the entire page or as a footer for individual sections like articles ...

Read More

How to display an image in HTML?

Nitya Raut
Nitya Raut
Updated on 16-Mar-2026 9K+ Views

Use the tag in HTML to display an image. The tag is a self-closing element that embeds images into web pages. It requires the src attribute to specify the image location and the alt attribute for accessibility. Syntax Following is the basic syntax for the tag − The tag is self-closing, meaning it doesn't require a closing tag. The src and alt attributes are essential for proper functionality and accessibility. IMG Tag Attributes The tag supports several attributes to control image display and behavior − ...

Read More

How do we add a single-line input field in HTML?

Anvi Jain
Anvi Jain
Updated on 16-Mar-2026 763 Views

To add a single-line input field in HTML, use the tag with type="text". This creates a text input field where users can enter data. The tag is a self-closing element and one of the most versatile form elements in HTML. Note: The article mentioned tag, but this tag has been deprecated since HTML 4.01 and removed entirely in HTML5. Modern web development uses the tag instead. Syntax Following is the basic syntax for creating a single-line input field − For better accessibility and user experience, it's recommended to ...

Read More

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

Sravani S
Sravani S
Updated on 16-Mar-2026 192 Views

The onmouseout attribute in HTML triggers when the mouse pointer moves away from an element. This event is commonly used for interactive effects like changing colors, hiding tooltips, or resetting element states when the user moves their cursor away. Syntax Following is the syntax for the onmouseout attribute − Content The script can be a JavaScript function call or inline JavaScript code that executes when the mouse pointer leaves the element. Basic Example Following example demonstrates the onmouseout event changing text color when the mouse leaves the heading − ...

Read More

Execute a script when a user navigates away from a page in HTML?

Nishtha Thakur
Nishtha Thakur
Updated on 16-Mar-2026 315 Views

When a user navigates away from a page, you can execute JavaScript code using the onpagehide event attribute. This event triggers when the user leaves the page by clicking a link, closing the browser tab, submitting a form, refreshing the page, or navigating to another URL. The onpagehide event is part of the HTML5 Page Visibility API and provides a reliable way to detect when users are leaving your page, making it useful for cleanup tasks, saving user data, or logging analytics. Syntax Following are the different ways to use the onpagehide event − HTML attribute ...

Read More

Execute a script each time the volume of a video/audio is changed in HTML?

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

The onvolumechange attribute fires when the user changes the volume of a video or audio element. This event triggers for any volume modification including volume up, volume down, mute, or unmute operations. Syntax Following is the syntax for using the onvolumechange attribute − ... ... The function is called whenever the volume property of the media element changes, including programmatic changes and user interactions with the volume controls. Using onvolumechange with Video Element Example Following example demonstrates the onvolumechange attribute with a video element − ...

Read More

How to display human readable date in HTML?

Priya Pallavi
Priya Pallavi
Updated on 16-Mar-2026 630 Views

Use the HTML tag to display human-readable dates and times while providing machine-readable datetime information for browsers, search engines, and assistive technologies. The element enhances accessibility and helps with SEO by making temporal content semantically meaningful. Syntax Following is the syntax for the HTML tag − Human readable date/time The datetime attribute is optional but recommended for providing precise machine-readable temporal information. Attributes The tag supports the following specific attribute − Attribute Value Description datetime Valid datetime string Specifies the ...

Read More
Showing 731–740 of 6,519 articles
« Prev 1 72 73 74 75 76 652 Next »
Advertisements