- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 601 Articles for Front End Scripts
![Kumar Varma](https://www.tutorialspoint.com/assets/profiles/13883/profile/60_73481-1512711460.jpg)
347 Views
To return the id of the first image, use the images property in JavaScript.ExampleYou can try to run the following code to return the id of the first image in a document −Live Demo var val = document.images.length; document.write("Number of images in the document: "+val); document.write("The id of the first image: "+document.images[0].id);
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
869 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);
![Saurabh Jaiswal](https://www.tutorialspoint.com/assets/profiles/500262/profile/60_1406912-1660202490.jpg)
2K+ 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
![Paul Richard](https://www.tutorialspoint.com/assets/profiles/13505/profile/60_52698-1512536733.jpg)
299 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
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
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);
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
422 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
![Swarali Sree](https://www.tutorialspoint.com/assets/profiles/13515/profile/60_84115-1512649510.jpg)
94 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
![Paul Richard](https://www.tutorialspoint.com/assets/profiles/13505/profile/60_52698-1512536733.jpg)
148 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() }
![Paul Richard](https://www.tutorialspoint.com/assets/profiles/13505/profile/60_52698-1512536733.jpg)
12K+ Views
Page redirection is a situation where you clicked a URL to reach a page X but internally you were directed to another page Y. It happens due to page redirection.To use a META Tag to redirect your site is quite easy. With this, use the http-equiv attribute to provide an HTTP header for the value of the content attribute.The following is an example of redirecting current page to another page after 2 seconds. If you want to redirect page immediately then do not specify the content attribute.ExampleLive Demo HTML Meta Tag This is demo text.
![Sharon Christine](https://www.tutorialspoint.com/assets/profiles/13517/profile/60_82215-1512649681.jpg)
160 Views
HTML5 Geolocation API lets you share your location with your favorite websites. A JavaScript can capture your latitude and longitude and can be sent to backend web server and do fancy location-aware things like finding local businesses or showing your location on a map.The geolocation APIs work with a new property of the global navigator object ie. Geolocation object.The getCurrentPosition method retrieves the current geographic location of the device. The location is expressed as a set of geographic coordinates together with information about heading and speed. The location information is returned to a Position object.ExampleYou can try to run the ... Read More