Found 10483 Articles for Web Development

How to return the number of images in a document with JavaScript?

Samual Sam
Updated on 23-Jun-2020 08:12:05

1K+ Views

To return the number of images in a document, use the images property in JavaScript.ExampleYou can try to run the following code to get the count of images −Live Demo                                            var val = document.images.length;          document.write("Number of images in the document: "+val);          

How is NaN converted to String in JavaScript?

Saurabh Jaiswal
Updated on 11-Aug-2022 12:17:10

3K+ Views

In this tutorial, we will learn how to convert NaN to String. NaN in JavaScript means Not a Number, whose type is Number but actually, it is not a number. To Convert, the NaN to a String we use Multiple methods some of which are discussed below. Using the String() Method Using the toString Method Using the || Operator Using the isNaN() Method Using Ternary Operator Using the String() Method The String() method in JavaScript is used to convert different values to String. To convert the NaN into String Just pass the NaN to this method. Here is ... Read More

Which event occurs in JavaScript when the dragged element is over the target?

Paul Richard
Updated on 23-Jun-2020 08:14:21

382 Views

The ondragover event triggers when the dragged element is over the drop target.ExampleYou can try to run the following code to learn how to implement ondragover event in JavaScript −Live Demo                    .drag {             float: left;             width: 100px;             height: 35px;             border: 2px dashed #876587;             margin: 15px;             padding: 10px;          }   ... Read More

What is the role of Browser Object Model (BOM) in JavaScript?

karthikeya Boyini
Updated on 23-Jun-2020 08:04:18

2K+ Views

The Browser Object Model (BOM) in JavaScript includes the properties and methods for JavaScript to interact with the web browser.BOM provides you with a window objects, for example, to show the width and height of the window. It also includes the window.screen object to show the width and height of the screen.ExampleYou can try to run the following code to learn how to get screen height and width −Live Demo                    document.write("Screen width: " + screen.width);          document.write("Screen width: " + screen.width);          

How to get the number of the internet host port for the current page in JavaScript?

Shubham Vora
Updated on 12-Oct-2022 08:28:46

631 Views

In this tutorial, we will learn to get the number of internet host port for the current page in JavaScript. The Port number is a 16-bit unique ID of protocols. The port number ranged from 0-65535. The port number is used to find a process by the server. There are 65535, and each port number is associated with its identity. So, let us look to get the port number for the current page in JavaScript. Following are the methods by which we can get the port number of the internet host − Using the location.port Property Using the URL ... Read More

How to load the previous URL in the history list in JavaScript?

Shubham Vora
Updated on 14-Sep-2022 13:33:47

6K+ Views

In this tutorial, we will learn to load the previous page in the history list in JavaScript. The Window object in JavaScript accesses the window in the browser. This object contains many properties and methods required to do the tasks. The Window object also retrieves the information from the browser window. There is a history stack in every browser that saves the pages visited by the user. To access this history stack, we can use the history object that is the property of the Window object. By accessing the history from the browser, we can go to the next or ... Read More

Which event occurs in JavaScript when a dragged element is dropped?

Swarali Sree
Updated on 23-Jun-2020 08:05:55

154 Views

The ondrop event triggers when a dragged element is dropped on the target. You can try to run the following code to learn how to implement ondrop event in JavaScript −ExampleLive Demo                    .drag {             float: left;             width: 100px;             height: 35px;             border: 2px dashed #876587;             margin: 15px;             padding: 10px;          } ... Read More

What is the role of the window.history object in JavaScript?

Paul Richard
Updated on 23-Jun-2020 08:00:51

224 Views

The window.history object is used to go back or to the next page of the web browser. It has the browser's history and comes with the following two methods −history.back − Go to previous URLhistory.next − Go to next URLExampleYou can try to run the following code to learn how to work with window.history object in JavaScript −Live Demo                    function backPage() {             window.history.back()          }          function nextPage() {             window.history.next()          }                      

How to load the next URL in the history list in JavaScript?

Shubham Vora
Updated on 14-Sep-2022 13:31:40

778 Views

In this tutorial, we will learn to load the next page in the history list in JavaScript. The Window object in JavaScript accesses the window in the browser. This object contains many properties and methods required to do the tasks. The Window object also retrieves the information from the browser window. There is a history stack in every browser that saves the pages visited by the user. To access this history stack, we can use the history object that is the property of the Window object. By accessing the history from the browser, we can go to the next or ... Read More

For the Hosts Locale how to convert a string to uppercase letters in JavaScript?

Shubham Vora
Updated on 15-Nov-2022 08:08:31

303 Views

In this tutorial, we will learn how to convert a string to uppercase letters for the host's locale in JavaScript. While using a locale language to write for a website, we might have to convert the sentence from lowercase to uppercase without changing the structure of the string. Using the toLocaleUpperCase() Method In JavaScript, we use the toUpperCase() Method as well as the toLocaleUpperCase() to change the letters of a string to uppercase. Although both methods give similar output the toLocaleUpperCase() is used primarily for local languages. Syntax We will use the following syntax to convert the letters of the ... Read More

Advertisements