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
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 MoreHow to Allow only Positive Numbers in the Input Number Type
The input number type in HTML allows users to enter numeric values, but by default it accepts both positive and negative numbers. To restrict input to only positive numbers, we need to combine HTML attributes with JavaScript validation techniques. The element provides several attributes for controlling numeric input: min, max, step, and value. However, the min attribute alone only restricts the spinner controls and form validation − users can still manually type negative numbers. Syntax Basic syntax for a number input with minimum value restriction − For complete positive-only restriction with ...
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 MoreHow to Move Image in HTML?
Moving images in HTML can be achieved through various methods, from traditional HTML tags to modern CSS properties and JavaScript. An image is added to a web page using the HTML tag, which is a self-closing element that simply includes attributes. While the HTML tag was previously used to create scrolling images, it is now deprecated in HTML5. Modern web development favors CSS properties and JavaScript for more precise control over image positioning and movement. Syntax The basic syntax for adding an image in HTML is − To move images, ...
Read MoreHow to Allow the File Input Type to Accept Only Image Files
The tag in HTML creates an input control that accepts user input. The type attribute determines the kind of input field displayed, such as text fields, checkboxes, buttons, or file uploads. When working with file uploads, you often need to restrict the allowed file types to only accept image files. The element by default accepts all file types, but you can limit it to images using the accept attribute or JavaScript validation. This ensures users can only select image files from their device. Syntax Following is the basic syntax for file input − ...
Read MoreHow to Add Multiple Elements in the Same Table?
In HTML tables, the element is used to group and organize the content of the table into sections. It is especially useful when working with large tables as it helps to manage and style the data effectively. While a table typically contains one , you can have multiple elements within the same table to structure data into different sections or categories. Syntax Following is the syntax for using multiple elements in a table − Header 1Header 2 ...
Read More