Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
HTML Articles
Page 77 of 151
How to specify citation in HTML?
The tag in HTML is used to specify citations or references to creative works such as books, articles, movies, songs, or research papers. The content within the tag typically appears in italics by default in most browsers, indicating that it represents the title of a referenced work. Syntax Following is the syntax for the tag − Title of the work The tag is an inline element that should contain only the title of the work being referenced, not the author's name or additional descriptive text. Basic Citation Example ...
Read MoreExecute a script when the user opens or closes the element in HTML?
The ontoggle event in HTML is triggered when a user opens or closes the element. This event allows you to execute JavaScript functions whenever the disclosure state of a details element changes, making it useful for tracking user interactions or updating content dynamically. Syntax Following is the syntax for the ontoggle event attribute − Summary text Content to be shown/hidden The ontoggle event fires both when the details element is opened (expanded) and when it is closed (collapsed). Basic Example Following example demonstrates ...
Read MoreExecute a script when a Web Storage area is updated in HTML?
The onstorage attribute in HTML is used to execute a script when the Web Storage area (localStorage or sessionStorage) is updated. This event is triggered when storage data changes in another window or tab of the same origin, making it useful for synchronizing data across multiple browser windows. Syntax Following is the syntax for the onstorage attribute − The onstorage event is typically attached to the element and fires when: Another window or tab modifies localStorage Another window or tab modifies sessionStorage Storage items are added, modified, or removed from ...
Read MoreExecute a script when the media is ready to start playing in HTML?
The oncanplay event in HTML is triggered when the browser has enough data to start playing a media element (audio or video) but may need to stop for further buffering. This event is essential for executing scripts when media becomes playable. Syntax Following is the syntax for the oncanplay event attribute − ... ... You can also use the addEventListener method in JavaScript − element.addEventListener("canplay", function() { // Your code here }); Using oncanplay with Video Element The oncanplay event is commonly used with video ...
Read MoreExecute a script when the playback position of the media has changed in HTML?
The ontimeupdate event in HTML triggers whenever the playback position of a media element changes. This event fires continuously during media playback, including when users seek to different positions, fast forward, rewind, or during normal playback progression. Syntax Following is the syntax for the ontimeupdate event attribute − You can also add the event listener using JavaScript − mediaElement.addEventListener('timeupdate', functionName); How It Works The ontimeupdate event fires approximately every 250 milliseconds during media playback, but this frequency may vary depending on the browser and system performance. The ...
Read MoreExecute a script when the media has started playing in HTML?
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 MoreExecute a script when the window's history changes in HTML?
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 MoreExecute a script when a mouse button is released over an element in HTML?
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 MoreHow do we create a footer for a document or section in HTML5?
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 MoreHow to display an image in HTML?
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