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 on Trending Technologies
Technical articles with clear explanations and examples
Execute 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 MoreHTML DOM Input Datetime name Property
The HTML DOM Input Datetime name property sets or returns the value of the name attribute of an input datetime element. The name attribute is used to reference form data after a form is submitted and identifies the input field in JavaScript. Note: The HTML5 input type="datetime" has been deprecated. Modern browsers use datetime-local instead, but this property works similarly for both types. Syntax Following is the syntax for returning the name value − inputDatetimeObject.name Following is the syntax for setting the name value − inputDatetimeObject.name = "string" Return ...
Read MoreHow to set horizontal header for a table?
Tables in HTML can have horizontal headers and vertical headers. A horizontal header displays column labels across the top of the table, while a vertical header displays row labels down the left side. For horizontal headers, we place all elements inside the first tag of the table. Horizontal vs Vertical Table Headers Horizontal Headers Name Age John 25 Sarah 30 Vertical Headers ...
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 MoreHTML DOM Input Datetime Object
The HTML DOM Input Datetime Object represents an HTML input element with type="datetime". This input type was designed to allow users to enter both date and time values. However, it's important to note that the datetime input type has been deprecated in HTML5 and is not supported by most modern browsers, which treat it as a regular text input instead. Note: Modern browsers support datetime-local instead of datetime. The datetime type was removed from the HTML specification because it lacked widespread browser support and had usability issues. Syntax Following is the syntax for creating an input element ...
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 MoreHTML DOM Input Datetime readOnly Property
The HTML DOM Input Datetime readOnly property is used to set or return whether a datetime input field can be modified by the user. When set to true, the input becomes read-only and cannot be edited, while false allows normal user interaction. Syntax Following is the syntax for returning the readOnly property value − inputDatetimeObject.readOnly Following is the syntax for setting the readOnly property − inputDatetimeObject.readOnly = booleanValue Parameters The booleanValue parameter accepts the following values − Value Description true Makes ...
Read MoreHow do I wrap text in a \'pre\' tag in HTML?
In this article, we are going to learn how to wrap text in a tag in HTML. The HTML tag is used to display preformatted blocks of text exactly as they appear in the source code, preserving all spaces, line breaks, and indentation. Preformatted text refers to content that has already been formatted and should be displayed without any additional formatting changes by the browser. The tag preserves whitespace and uses a monospace font by default, making it ideal for displaying code, poetry, ASCII art, or any text where spacing is important. Syntax Following ...
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 MoreHTML DOM Input Datetime required Property
The HTML DOM Input Datetime required property determines whether a datetime input field must be filled before form submission. When set to true, the browser prevents form submission if the datetime field is empty and displays a validation message. Syntax Following is the syntax for getting the required property − inputDatetimeObject.required Following is the syntax for setting the required property − inputDatetimeObject.required = booleanValue Parameters The required property accepts a boolean value − Value Description true Makes the datetime field mandatory ...
Read More