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 AmitDiwan
Page 237 of 840
HTML DOM Storage Event
The HTML DOM storage event is triggered when changes occur in the browser's storage areas (localStorage or sessionStorage). This event fires when another window, tab, or frame modifies the storage, making it useful for synchronizing data across multiple windows of the same origin. The storage event is particularly valuable for creating real-time communication between different browser windows or tabs without requiring server-side communication. It only triggers when the storage change originates from a different browsing context, not from the current window itself. Syntax Following is the syntax for adding a storage event listener − window.addEventListener("storage", ...
Read MoreHow to use tables to structurize forms in HTML?
Tables can be used to create structured and organized forms in HTML. Using tables for form layout provides better alignment and visual organization of form elements, making forms more readable and professional-looking. Let us first understand how to create a basic form and then see how tables enhance form structure. Basic Form Structure The tag creates a container for form elements. Form controls like input fields, buttons, and labels are placed within this container to collect user data. Syntax Example − Simple Form Following example ...
Read MoreHTML DOM Storage getItem() method
The HTML DOM Storage getItem() method is used to retrieve the value of a specific item from web storage by providing its key name. If the key exists, it returns the stored value as a string. If the key doesn't exist, it returns null. The getItem() method works with both localStorage (persistent storage) and sessionStorage (temporary storage that expires when the tab closes). Syntax Following is the syntax for the Storage getItem() method − localStorage.getItem(keyname); OR sessionStorage.getItem(keyname); Parameters The getItem() method accepts a single parameter − ...
Read MoreHow to apply CSS to iframe?
To apply CSS to iframe is a straightforward process using any of the three methods of adding CSS to HTML documents. An iframe element can be styled just like any other HTML element using inline, internal, or external CSS. Styling iframes is commonly needed to control their appearance, set dimensions, add borders, and ensure they integrate seamlessly with your page design. Each CSS approach offers different advantages depending on your specific requirements. Syntax The basic syntax for styling an iframe with CSS − iframe { /* CSS properties */ ...
Read MoreHTML ondblclick Event Attribute
The HTML ondblclick attribute is an event handler that triggers when a user double-clicks on an HTML element. This attribute allows you to execute JavaScript code in response to the double-click mouse event. Syntax Following is the syntax for using the ondblclick attribute − Content Parameters script − The JavaScript code to execute when the element is double-clicked. This can be a function call or inline JavaScript statements. Example − Button Double-Click Following example demonstrates the ondblclick event attribute with a button element − ...
Read MoreHTML DOM Object form Property
The HTML DOM Object form property returns a reference to the form element that contains an element. This property is read-only and provides a way to access the parent form from within JavaScript when working with object elements. Syntax Following is the syntax for accessing the form property − ObjectElement.form Return Value The property returns a reference to the HTMLFormElement that contains the object, or null if the object element is not enclosed within a form. Example Following example demonstrates how to use the Object form property to get a ...
Read MoreHTML DOM Storage length property
The HTML DOM Storage length property returns the number of key-value pairs stored in the browser's storage object. This property works with both localStorage and sessionStorage objects, providing a simple way to count stored items. Syntax Following is the syntax for the Storage length property − localStorage.length sessionStorage.length Return Value The length property returns an integer representing the number of items currently stored in the storage object. If no items are stored, it returns 0. Example − localStorage Length Following example demonstrates how to get the number of ...
Read MoreHTML max Attribute
The max attribute in HTML specifies the maximum value for various input elements and the element. It defines the upper bound of the allowed range, ensuring that users cannot enter or display values beyond this limit. Syntax Following is the syntax for the max attribute − Where value is a number (for numeric inputs) or a date string (for date inputs) that sets the maximum allowed value. Elements Supporting Max Attribute The max attribute can be used with the following HTML elements − ...
Read MoreHTML DOM Storage setItem() method
The HTML DOM Storage setItem() method is used to create or update a key-value pair in web storage. This method stores data in either localStorage (persistent across browser sessions) or sessionStorage (temporary for the current session) by specifying a key name and its corresponding value. Syntax Following is the syntax for the Storage setItem() method − localStorage.setItem(keyname, value); OR sessionStorage.setItem(keyname, value); Parameters The setItem() method accepts two parameters − keyname − A string representing the key name under which the data will be stored. ...
Read MoreHTML DOM Variable Object
The HTML DOM Variable Object represents the element in the DOM tree. The element is used to define variables in mathematical expressions, programming code examples, or technical documentation. When accessed through JavaScript, it becomes a DOM object with properties and methods for manipulation. Syntax Following is the syntax to create a var object using JavaScript − document.createElement("VAR"); Following is the syntax for the HTML element − variable_name Creating a Variable Object The var object can be created dynamically using JavaScript's createElement() method. Once created, you can ...
Read More