Found 9054 Articles for Front End Technology

How to return a number of bits used to display one color on a window screen in JavaScript?

Prabhdeep Singh
Updated on 07-Nov-2022 06:57:03

127 Views

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 number ... Read More

How to work with document.links in JavaScript?

Shubham Vora
Updated on 15-Nov-2022 10:26:59

674 Views

In this tutorial, let us discuss how to work with the document's link in JavaScript. The document link property is a read-only DOM level 1 feature that returns all the links. The links property gives all the anchor elements and area tags with a href attribute. Working with document.links properties Let us learn to work with a link's properties. Users can follow the syntax below to work with the link's properties. Syntax let links = document.links; links.propertyName; The above syntax returns all anchor tags, area tags, and properties. Properties length − The length is the number of elements ... Read More

What are the properties of window.screen object in JavaScript?

Shubham Vora
Updated on 31-Oct-2022 11:16:00

364 Views

In this tutorial, we will discuss the properties of the window.screen object in JavaScript. The window comes under the Browser Object Model – BOM. The window's screen object holds information on the user's screen. Because the scope of the window object is high, we can also write the window's screen object as "screen". There are no direct methods for the screen object. The object's use is to improve the UI experience of a webpage. Properties of window.screen Object availHeight The availHeight property returns the screen height, excluding the Windows Taskbar. availWidth The availWidth property returns the screen width, excluding the ... Read More

How to return the protocol (http or https) of the web page with JavaScript?

Prabhdeep Singh
Updated on 07-Nov-2022 08:02:14

701 Views

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 computer. 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 More

How to work with document.forms in JavaScript?

Shubham Vora
Updated on 31-Oct-2022 11:11:45

3K+ Views

In this tutorial, let us discuss how to work with document.forms in JavaScript. The document.form property returns all the form tags in the document. The forms property is read-only. The form property is the Dom level 1 feature. Working with form attributes and elements Here let us learn to work with a form's properties, attributes, and elements. Users can follow the syntax below to work with the form's properties and elements. 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 ... Read More

How to work with document.head in JavaScript?

Shubham Vora
Updated on 15-Nov-2022 09:14:52

1K+ Views

In this tutorial, let us discuss how to work with the document's head in JavaScript. The document head property is a dom level 3 read-only feature. The document's head property returns all the head tags in the document. HTML adds an empty head tag in case it is not present. The property returns the first head element in case there are many. The head tag contains the document header information like title, keywords, description, and style sheet. Every document needs a head tag. But start and end tags are optional. The first body tag or the first frameset tag becomes ... Read More

How to work with document.documentElement in JavaScript?

Shubham Vora
Updated on 31-Oct-2022 11:08:45

3K+ Views

In this tutorial, we will learn to work with document.documentElement property in JavaScript. JavaScript DOM is a JavaScript script that can dynamically read or change the webpage's content. There are numerous properties available in the JavaScript DOM. We can access, change and style every element on the webpage. The document is the property of dom that is the root of the HTML webpage. It again consists of its child properties. The documentElement is the child property of the document property in dom. It is used to get the root element of the document. It returns an object consisting of the ... Read More

How to work with document.body in JavaScript?

Shubham Vora
Updated on 31-Oct-2022 11:53:23

7K+ Views

In this tutorial, we will learn how to work with document.body in JavaScript. Use the document.body property in JavaScript to get the body of the document, i.e., tag. The tag defines the body of the document. The entire content of an HTML document, including all headings, paragraphs, images, hyperlinks, tables, lists, and other elements, is contained in the element. In an HTML document, there can only be one element. In this tutorial, we will work with the document.body in JavaScript for − Change the background color of the body Add a new element at the ... Read More

How to work with document.anchors in JavaScript?

Shubham Vora
Updated on 15-Nov-2022 09:12:14

550 Views

In this tutorial, let us discuss how to work with the document's anchor in JavaScript. Relevant web technologies no longer recommend this property. Some browsers still recommend it for compatibility reasons. The document anchor property is a read-only feature that returns all the anchor tags. The anchor tag represents the start and end of a hyperlink. The anchor tag attributes are name, href, rel, rev, title, urn, and method. All attributes are optional. But a name attribute is mandatory for document anchors to work. Working with anchor’s properties Let us learn to work with an anchor's properties. Users can follow ... Read More

What are the rules to be followed for Object Definitions in JavaScript?

Shubham Vora
Updated on 31-Oct-2022 11:18:39

237 Views

In this tutorial, we will discuss the rules to follow for Object Definitions in JavaScript. JavaScript is an object-oriented scripting language. An object contains many properties. The property consists of a key and a value. The property is known as a method when this value is a function. Predefined objects are available in the browser. We can also define our objects. A real-life example of an object is a cup. The color, design, weight, and material are the main properties of a cup. The object name and the property name are case-sensitive. To define a property, we need to assign ... Read More

Advertisements