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
Front End Technology Articles
Page 350 of 652
How to work with document.forms in JavaScript?
In this tutorial, let us discuss how to work with document.forms in JavaScript. The document.forms property returns a collection of all form elements in the document. This property is read-only and provides access to form elements, their properties, and methods. It's part of the DOM Level 1 specification. Syntax var forms = document.forms; let formLen = forms.length; let formId = forms[0].id || forms.item(0).id; let formItemId = forms[0].elements[0].id; let formItemVal = forms[0].elements[0].value; let formData = forms.namedItem("testForm").innerHTML; The above syntax returns the collection of forms, total number of forms, form ID, form element ID, form element ...
Read MoreHow to return the protocol (http or https) of the web page with JavaScript?
In this tutorial, we will look at how to find which protocol is being used by a web page. A web page mostly uses http or https protocol. A protocol is a type of standard which is used to specify how the data is transferred or transmitted between different sets of computers. HTTP − HTTP is a protocol for retrieving resources such as HTML pages. It is one of the most essential and the backbone for all types of data exchange that happens over the internet. HTTP is a client-server protocol which means that all the requests are done ...
Read MoreHow to work with document.links in JavaScript?
In JavaScript, the document.links property provides access to all anchor () and area () elements that have an href attribute. This DOM property returns a live HTMLCollection of clickable links in the document. Syntax let links = document.links; Properties The document.links collection provides one main property: length − Returns the number of links in the collection. Working with document.links Properties The example below demonstrates how to access link properties. Note that only elements with href attributes are included in the collection. Working ...
Read MoreHow to return a number of bits used to display one color on a window screen in JavaScript?
In this tutorial, we will explore how we can find out the number of bits that are used to display a single color on the screen of our device using JavaScript. JavaScript has many inbuilt functions that allow us to get information about the various properties of the display screen. We'll be using one such function to accomplish the task mentioned above. As discussed in the previous section, we want to find out the exact number of bits that are used to display a particular color on the user's display screen by using JavaScript. Before we can access the ...
Read MoreHow to set the amount by which the border image area extends beyond the border box with JavaScript?
In this tutorial, we will learn how to set the amount by which the border image area extends beyond the border box in JavaScript. To set the amount by which the border image is extended, you need to set the border outside edges. To do this we can apply the borderImageOutset style property provided in JavaScript. After creating a border image area for the HTML element, we might have to increase the area. By knowing a method to increase the border image area more than the border box, we can make the change without writing lengthy code. Using ...
Read MoreHow null is converted to Number in JavaScript?
In JavaScript, null is a primitive value that represents the intentional absence of any object value. When null is converted to a number, it becomes 0. This article explores various methods to convert null to a number in JavaScript. Using Number() Method Using Logical OR (||) Using the ~~ operator Using Ternary Operator Using arithmetic operations Using the Number() Method The Number() method is the most straightforward way to convert null to a number. It explicitly converts null to 0. Syntax Number(null) Example ...
Read MoreHow to attach one or more drop-shadows to the box with JavaScript?
To attach one or more drop shadows to a box with JavaScript, you can use the boxShadow style property. You can specify the shadow's horizontal offset, vertical offset, blur radius, spread radius, and color. Syntax Following is the syntax to add one or more drop shadows to the box with JavaScript: element.style.boxShadow = "offset-x offset-y blur-radius spread-radius color"; Parameters The boxShadow property accepts the following parameters: offset-x − Horizontal offset of the shadow. Positive values create a shadow on the right side, negative values on the left ...
Read MoreHow to return the position of the element relative to floating objects in JavaScript?
This tutorial teaches us how to return the position of the element relative to floating objects in JavaScript. To set the relative position or to get or return the relative position we are going to use the 'clear' property of JavaScript which is defined under the style property of an object. The CSS clear property controls how an element behaves next to floating elements. It can have values like 'left', 'right', 'both', or 'none'. When an element has the clear property set, it will move down to avoid overlapping with floated elements on the specified side. Syntax ...
Read MoreHow to set the inward offsets of the image border with JavaScript?
In this tutorial, we will learn how to set the inward offsets of the image border with JavaScript. An image can be set in the border as a border image using CSS properties. The border image can be set using different parameters. To set the inward offsets of the image border, use the borderImageSlice property in JavaScript. We will see two different approaches to setting up the inward offsets of the image border with JavaScript − The borderImageSlice Property The setProperty Method Using the borderImageSlice Property ...
Read MoreHow null is converted to Boolean in JavaScript?
In JavaScript, null is a primitive value that represents an intentional absence of any object value. When converting null to Boolean, it always evaluates to false because null is considered a falsy value in JavaScript. Understanding Falsy Values In JavaScript, null is one of the falsy values along with undefined, 0, "" (empty string), NaN, and false. All falsy values convert to false when used in Boolean contexts. Using the Boolean() Function The Boolean() function converts any value to its Boolean equivalent. For null, it always returns false. Syntax Boolean(null) Example ...
Read More