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 264 of 840
HTML DOM Window closed Property
The HTML DOM Window closed property returns a boolean value that indicates whether a window reference is closed or not. This property is particularly useful when working with popup windows opened using window.open(), allowing you to check their state before performing operations. Syntax Following is the syntax for the Window closed property − window.closed Return Value The closed property returns − true − If the window is closed or was never opened false − If the window is currently open Note: For the main browser window, this property always ...
Read MoreRetrieve the position (X,Y) of an HTML element
The position (X, Y) of an HTML element refers to its coordinates on a web page, where X represents the horizontal position and Y represents the vertical position. JavaScript provides several methods to retrieve these coordinates relative to different reference points like the viewport, document, or parent element. The getBoundingClientRect() Method The getBoundingClientRect() method is the most commonly used approach to get an element's position. It returns a DOMRect object containing the element's size and position relative to the viewport. Syntax var rect = element.getBoundingClientRect(); var x = rect.x; // or rect.left var y ...
Read MoreHTML DOM Input Week Object
The HTML DOM Input Week Object represents an HTML input element with type week. This object allows users to select a specific week and year, providing methods and properties for manipulating week-based form inputs programmatically. Syntax Following is the syntax to create an input element with type week using JavaScript − var weekObject = document.createElement("INPUT"); weekObject.type = "week"; You can also access an existing week input element − var weekObject = document.getElementById("weekId"); Properties The Input Week Object supports the following properties − Property Description ...
Read MoreHTML DOM DT object
The HTML DOM DT object is associated with the HTML element, which represents a description term in a description list. The DT object allows you to create and manipulate elements dynamically using JavaScript, enabling interactive generation of definition lists on web pages. The element is typically used within a (description list) container alongside (description definition) elements to create structured lists of terms and their descriptions. Syntax Following is the syntax for creating a DT object − var dtElement = document.createElement("DT"); Following is the syntax for accessing an existing ...
Read MoreHTML DOM Textarea Object
The HTML DOM Textarea Object represents the element in an HTML document. This object provides properties and methods to create, access, and manipulate textarea elements dynamically using JavaScript. The textarea object is commonly used for multi-line text input in forms. Creating a Textarea Object You can create a new textarea element using the document.createElement() method − Syntax document.createElement("TEXTAREA"); Once created, you can set its properties and append it to the DOM to make it visible on the page. Properties of Textarea Object The textarea object provides numerous properties to control ...
Read MoreHow to display Base64 images in HTML?
To display images encoded with Base64, you need to get the base64 encoded string and use the img element. This prevents the page from loading slowly and saves the web browser from additional HTTP requests. Base64 images are embedded directly into HTML using Data URLs, which eliminate the need for separate image files. This technique is useful for small images, icons, or when you want to reduce HTTP requests. Syntax Following is the syntax for displaying a Base64 image in HTML − Where − [format] is the image format (jpeg, png, ...
Read MoreHTML DOM Textarea cols Property
The HTML DOM Textarea cols property gets and sets the value of the cols attribute of a textarea element. The cols attribute specifies the visible width of a textarea in average character widths. The cols property is useful for dynamically adjusting textarea dimensions through JavaScript, allowing you to change the visual width of text areas based on user interactions or content requirements. Syntax Following is the syntax to return the cols value − textareaObject.cols Following is the syntax to set the cols value − textareaObject.cols = number Here, number ...
Read MoreHow to make an element width: 100% minus padding?
Making an element occupy 100% width minus its padding is a common CSS challenge. When you set width: 100% on an element with padding, the total width becomes 100% plus the padding, causing overflow issues. There are several effective methods to achieve the desired layout. The Problem with Width: 100% and Padding By default, CSS uses the content-box model, where width: 100% applies to the content area only. Padding is added outside this width, making the total element width exceed 100% of its container. CSS Box Model: width: 100% + padding ...
Read MoreHTML DOM Bdo dir Property
The HTML DOM Bdo dir property is associated with the HTML element. Here, bdo stands for Bi-Directional Override. The tag is used to override the current text direction which is by default left to right. The bdo dir property sets or returns the dir attribute value of a element. The dir property is compulsory for the element and specifies the direction of the text flow. Syntax Following is the syntax for setting the dir property − bdoObject.dir = "ltr|rtl" Here, ltr is left-to-right text direction, whereas rtl is right-to-left text ...
Read MoreHTML DOM Input Search form Property
The HTML DOM Input Search form property returns a reference to the form element that contains the input search field. If the search field is not inside any form, it returns null. This property is read-only and helps identify the parent form of a search input for validation or manipulation purposes. Syntax Following is the syntax for the input search form property − searchObject.form Return Value The form property returns − A form object reference if the input search field is inside a form element null if the input search field ...
Read More