Javascript Articles - Page 583 of 671

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 convert Decimal to Binary in JavaScript?

Shubham Vora
Updated on 10-Aug-2022 11:51:59

21K+ Views

This tutorial will teach us to convert the decimal number to a binary number string. The binary number is the string of only 0 and 1. The computer doesn’t understand the high-level programming language, so we need to instruct the computer in a low-level language, represented as the binary string. Also, binary string is used in digital electronics. Here, we have three methods to convert the decimal number to a binary string. Using the toString() Method Using the right shift Operation Using the modulo Operator Using the toString() Method The toString() method is JavaScript built-in string method that ... Read More

How to work with document.embeds in JavaScript?

Jai Janardhan
Updated on 20-May-2020 10:51:40

190 Views

Use the document.embeds property in JavaScript to get the number of tags in a document.ExampleYou can try to run the following code to implement document.embeds property in JavaScript.Live Demo           JavaScript Example                              var num = document.embeds.length;          document.write("How many embed tags: "+num);          

How to work with document.body in JavaScript?

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

10K+ 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

What is JavaScript Bitwise XOR (^) Operator?

Abhinaya
Updated on 20-May-2020 10:50:12

280 Views

If both the bits are different, then 1 is returned when Bitwise OR (|) operator is used.ExampleYou can try to run the following code to learn how to work with JavaScript Bitwise XOR Operator.                    document.write("Bitwise XOR Operator");          // 7 = 00000000000000000000000000000111          // 1 = 00000000000000000000000000000001          document.write(7 ^ 1);          

How to work with document.anchors in JavaScript?

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

873 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 is JavaScript Bitwise NOT(~) Operator?

Anjana
Updated on 20-May-2020 09:36:34

288 Views

The Bitwise NOT (~) Operator performs NOT operation on the bits. You can try to run the following code to learn how to work with JavaScript Bitwise NOT Operator.Example                    document.write("Bitwise NOT Operator");          // 7 = 00000000000000000000000000000111          document.write(~7);          

How to get the value of the usemap attribute in JavaScript?

Sharon Christine
Updated on 23-Jun-2020 08:53:15

303 Views

To get the value of the usemap attribute of a link in JavaScript, use the useMap property. The usemap attribute is used to tell that the document is html (text/html) or css (text/css), etc.Client-side image maps are enabled by the usemap attribute for the tag and defined by special and extension tags. The image that is going to form the map is inserted into the page using the element as normal, except that it carries an extra attribute called usemap.ExampleYou can try to run the following code to get the value of the usemap attribute of a link ... Read More

What is JavaScript Bitwise OR (|) Operator?

Alankritha Ammu
Updated on 20-May-2020 09:35:39

227 Views

If one of the bits are 1, then 1 is returned when Bitwise OR (|) operator is used.ExampleYou can try to run the following code to learn how to work with JavaScript Bitwise OR Operator.                    document.write("Bitwise OR Operator");          // 7 = 00000000000000000000000000000111          // 1 = 00000000000000000000000000000001          document.write(7 | 1);          

How to get the value of the type attribute of a link in JavaScript?

Paul Richard
Updated on 20-May-2020 09:35:04

573 Views

To get the value of the type attribute of a link in JavaScript, use the type property. The type attribute is used to tell that the document is html (text/html) or css (text/css), etc.ExampleYou can try to run the following code to get the value of the type attribute of a link.Live Demo           Qries                var myVal = document.getElementById("anchorid").type;          document.write("Value of type attribute: "+myVal);          

Advertisements