The onbeforeprint attribute in HTML is an event handler that executes a JavaScript function before a document is printed. This attribute triggers when the user attempts to print the page through browser print functionality (Ctrl+P, File → Print, or print button), displaying custom messages or performing actions before the print dialog appears. The onbeforeprint event is commonly used together with the onafterprint attribute to handle print preparation and cleanup tasks. It belongs to the HTML event attributes category and can be applied to the element or used with JavaScript event listeners. Syntax Following is the syntax ... Read More
To add a container for an external application in HTML5, we use the tag. It defines a container for an external resource like web pages, media players, pictures, or plug-in applications. The embed element is a self-closing tag that provides a generic way to include external content when more specific HTML5 elements are not suitable. Syntax Following is the basic syntax for the embed tag in HTML − The tag is self-closing and does not require a closing tag. It supports global and event attributes in HTML5. Attributes The ... Read More
The onbeforeunload event attribute in HTML fires when the document is about to be unloaded, such as when a user closes the browser tab, navigates away from the page, or refreshes it. This event is commonly used to warn users about unsaved changes or to perform cleanup operations before the page is destroyed. Syntax Following is the syntax for the onbeforeunload event attribute − The event handler function can return a string message that will be displayed in the browser's confirmation dialog. However, modern browsers may show their own generic message instead of ... Read More
The HTML DOM Input Color autofocus property sets or returns whether a color input field automatically receives focus when the page loads. When set to true, the color input will be highlighted and ready for user interaction immediately upon page load. Syntax Following is the syntax for returning the autofocus property value − inputColorObject.autofocus Following is the syntax for setting the autofocus property − inputColorObject.autofocus = booleanValue Parameters The booleanValue parameter can be one of the following − Value Description true ... Read More
The onhashchange event in HTML executes a script whenever the anchor part (hash fragment) of the URL changes. The anchor part refers to the portion of the URL that comes after the # symbol, commonly used for navigation within a page or single-page applications. This event is particularly useful for detecting when users navigate using the browser's back/forward buttons or when the URL hash is programmatically modified. The hash change can be detected using either the onhashchange attribute or JavaScript event listeners. Syntax Following is the syntax for the onhashchange attribute − ... Read More
The HTML DOM Input Color defaultValue property sets or returns the default value of a color input field. This property represents the initial value specified in the HTML value attribute, which may differ from the current value if the user has changed the color selection. Syntax Following is the syntax for getting the default value − inputColorObject.defaultValue Following is the syntax for setting the default value − inputColorObject.defaultValue = "colorValue" Parameters The defaultValue property accepts a string parameter representing a valid hexadecimal color value − ... Read More
Use the tag to include information about the document. The HTML element contains metadata and other information about the document that is not displayed directly in the browser window. This section provides essential information to browsers, search engines, and other web services about your HTML document. Syntax Following is the basic syntax for the element − Common Elements in the Head Section The section typically contains several important elements − − Defines the document title shown in the browser tab ... Read More
The Input Color form property in HTML DOM returns a reference to the form element that contains the color input. This read-only property is useful for accessing the parent form of a color input element programmatically. Syntax Following is the syntax for accessing the form property − inputColorObject.form Return Value The form property returns a reference to the HTMLFormElement object that contains the color input. If the input is not inside a form, it returns null. Example − Getting Form Reference Following example demonstrates how to get the form reference of ... Read More
The HTML DOM Input Color name property gets or sets the value of the name attribute for an input color element. The name attribute is crucial for form submission, as it identifies the color input field when the form data is sent to the server. Syntax Following is the syntax for getting the name property − inputColorObject.name Following is the syntax for setting the name property − inputColorObject.name = "string" Return Value The name property returns a string representing the value of the name attribute of the input color ... Read More
The tag in HTML creates a horizontal rule that defines a thematic break in an HTML page. It is commonly used to visually separate content sections or indicate a change in topic within a document. The tag is a self-closing element that requires no closing tag. Syntax Following is the basic syntax for the tag − In modern HTML5, the tag is styled using CSS rather than HTML attributes. However, for compatibility, some legacy attributes are still recognized − Legacy Attributes The following ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Economics & Finance