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
Articles by Chandu yadav
Page 16 of 81
Execute a script each time the volume of a video/audio is changed in HTML?
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 MoreExecute a script at the start of a drag operation in HTML?
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 MoreExecute a script when the cue changes in a element in HTML?
The oncuechange event attribute executes a script when the active cue changes in a element. This event is particularly useful for video and audio elements that use text tracks for subtitles, captions, or descriptions. The oncuechange event fires whenever the browser switches from one cue to another in a text track, allowing developers to respond to subtitle changes, implement custom subtitle styling, or trigger other actions based on the current cue. Syntax Following is the syntax for the oncuechange attribute − Where script is the JavaScript code to execute when the ...
Read MoreHTML alt Attribute
The alt attribute of the element is used to set alternate text for a clickable area in an image map. This alternate text is displayed when the image cannot load or when users use screen readers for accessibility. The alt text also appears as a tooltip when hovering over the clickable area. Syntax Following is the syntax for the alt attribute in the element − Here, descriptive text is the alternate text that describes the purpose or destination of the clickable area. Purpose and Importance The alt attribute serves ...
Read MoreHTML download Attribute
The download attribute of the element is used to set the name of the file to be downloaded when a user clicks on the hyperlink. This attribute forces the browser to download the linked resource instead of navigating to it. Syntax Following is the syntax for the download attribute − Here, filename is the suggested name for the downloaded file. If the value is omitted, the browser will use the original filename from the server. Parameters The download attribute accepts the following value − filename (optional) − A ...
Read MoreHTML for Attribute
The for attribute of the element establishes a relationship between the calculation result and the input elements used in that calculation. This attribute helps browsers and assistive technologies understand which form controls contribute to the output value. Syntax Following is the syntax for the for attribute − result The value is a space-separated list of element IDs that participate in the calculation. These IDs must reference form controls within the same document. Parameters The for attribute accepts the following parameter − id list − A space-separated string of element ...
Read MoreHTML size Attribute
The size attribute in HTML controls the number of visible options displayed in a element. When the size is set to 1 or omitted, the select element appears as a dropdown list. When size is greater than 1, it displays as a list box showing multiple options simultaneously with a scrollbar if needed. Syntax Following is the syntax for the size attribute − Option 1 Option 2 Here, number is a positive integer representing the number of visible options. If the size attribute is not ...
Read MoreHow to copy the content of one HTML5 Canvas to another Canvas locally?
The drawImage() method in HTML5 Canvas allows you to copy content from one canvas to another canvas locally within the same web page. This method can draw images, canvases, and videos onto a canvas element, making it perfect for duplicating or transferring canvas content. Syntax Following is the basic syntax for copying canvas content using drawImage() − destinationContext.drawImage(sourceCanvas, dx, dy); Where sourceCanvas is the source canvas element, and dx, dy are the destination coordinates on the target canvas. How Canvas Copying Works To copy canvas content, you need to obtain the 2D ...
Read MoreHTML5 inline video on iPhone vs iPad/Browser
The allowsInlineMediaPlayback property controls whether videos play inline within the webpage or launch in fullscreen mode on iOS devices. By default, iPhones force videos to play fullscreen, while iPads allow inline playback, creating inconsistent user experiences across devices. Understanding this behavior is crucial for web developers creating video content that works seamlessly across all iOS devices and maintains consistent functionality with desktop browsers. Default iOS Video Playback Behavior On iOS devices, video playback behavior differs significantly − iPhone (iOS 9 and earlier) − Videos automatically launch in fullscreen mode, preventing simultaneous display of other content. ...
Read MoreDrawing text to HTML5 with @fontface does not work at the first time
Drawing text in an HTML5 canvas with a typeface loaded via @font-face often fails to display correctly on the first render. This occurs because the browser has not yet fully loaded the custom font from the network, causing it to fall back to a default system font instead. The key issue is timing − the canvas attempts to draw text before the custom font has finished downloading and becomes available to the rendering engine. Syntax Following is the basic syntax for defining a custom font with @font-face − @font-face { font-family: 'CustomFont'; ...
Read More