Javascript Articles - Page 598 of 671

What is the difference between setTimeout() and setInterval() in JavaScript?

Rishi Rathor
Updated on 24-Nov-2023 00:58:53

2K+ Views

setTimeout() function setTimeout( function, duration) − This function calls function after duration milliseconds from now. This goes for one execution. Let’s see an example − It waits for 2000 milliseconds, and then runs the callback function alert(‘Hello’) − setTimeout(function() { alert('Hello');}, 2000); setInterval() function setInterval(function, duration) − This function calls function after every duration milliseconds. This goes for unlimited times. Let’s see an example − It triggers the alert(‘Hello’) after every 2000 milliseconds, not only once. setInterval(function() { alert('Hello');}, 2000);

With JavaScript how can I find the name of the web browser, with version?

Abhinaya
Updated on 23-Jun-2020 07:01:42

332 Views

To find the name of the web browser, with version, you need to try the following code −Example           Browser Detection Example                                  

What are different Navigator properties I can use on my web page?

Daniol Thomas
Updated on 23-Jun-2020 07:02:17

179 Views

can use several Navigator related properties in your Web page. The following are the properties −Sr.NoProperty & Description1appCodeNameThis property is a string that contains the code name of the browser, Netscape for Netscape and Microsoft Internet Explorer for Internet Explorer.2appVersionThis property is a string that contains the version of the browser as well as other useful information such as its language and compatibility.3languageThis property contains the two-letter abbreviation for the language that is used by the browser. Netscape only.4mimTypes[]This property is an array that contains all MIME types supported by the client. Netscape only.5platform[]This property is a string that contains ... Read More

How can I add debugging code to my JavaScript?

Krantik Chavan
Updated on 17-Jan-2020 11:06:09

217 Views

To add debugging code to JavaScript, use the alert() or document.write() methods in your program. For example,var debugging = true; var whichImage = "widget"; if( debugging ) alert( "Calls swapImage() with argument: " + whichImage ); var swapStatus = swapImage( whichImage ); if( debugging ) alert( "Exits swapImage() with swapStatus=" + swapStatus );Examine the content and order of the alert() as they appear, you can examine the health of your program very easily.

How to use JavaScript to create client-side image map?

Abhishek
Updated on 25-Nov-2022 07:16:43

2K+ Views

In this tutorial, we will see how we can create a client-side image map using JavaScript. We use JavaScript to create a client-side image map. 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. The value of the usemap attribute is the value of the name attribute on the element, which you are about to meet, preceded ... Read More

How to reduce the number of errors in scripts?

Ramu Prasad
Updated on 23-Jun-2020 07:03:36

247 Views

To reduce the number of errors in scripts, follow the below-given tips −Use plenty of comments. Comments enable you to explain why you wrote the script the way you did and to explain particularly difficult sections of code.Always use indentation to make your code easy to read. Indenting statements also make it easier for you to match up the beginning and ending tags, curly braces, and other HTML and script elements.Write modular code. Whenever possible, group your statements into functions. Functions let you group related statements, and test and reuse portions of code with minimal effort.Be consistent in the way you ... Read More

How to play a multimedia file using JavaScript?

Shubham Vora
Updated on 15-Sep-2022 12:02:02

2K+ Views

In this tutorial, we will learn how to play a multimedia file using JavaScript. The multimedia file is the audio and video files. The multimedia files can be of different formats. wav and mp3 are two examples of audio file formats, whereas mp4 and mkv are examples of video file formats. In HTML, multimedia files can be shown easily using different tags. We use the video tag for showing a video, and for audio, we use the audio tag. These two tags are quite similar, and many attributes are the same in both tags. The "src" attribute defines the path ... Read More

What does a JavaScript plugin consist of?

Shubham Vora
Updated on 31-Oct-2022 11:24:48

3K+ Views

In this tutorial, we will discuss plugins in JavaScript. So what is a plugin? A plugin is a JavaScript code written in a file. This file supplies various methods that we can use for various purposes. A plugin has an entry in the array. An entry has following properties − name − The name is the plugin name. filename − filename is the executable file loaded to install the plugin with the extension. description − description is the developer's(manufacturer's) description of the plugin. mimeTypes − mimeTypes is an array with one entry for each MIME type that the plugin ... Read More

How to list down all the plug-in installed in your browser?

Nitya Raut
Updated on 23-Jun-2020 06:55:20

1K+ Views

To list down all the plug-on installed in the web browser, use the JavaScript navigator object. The JavaScript navigator object includes a child object called plugins. This object is an array, with one entry for each plug-in installed on the browser.ExampleYou can try to run the following code to list down all the plug-in installed in your browser −           List of Plug-Ins                                       Plug-in Name             Filename             Description                                 for (i = 0;  i < navigator.plugins.length;  i++)             {                document.write("");                document.write(navigator.plugins[i].name);                                document.write("");                document.write(navigator.plugins[i].filename);                                document.write("");                document.write(navigator.plugins[i].description);                document.write("");             }                    

How to differentiate between Manual and Automated Animation in JavaScript?

Shubham Vora
Updated on 26-Oct-2022 07:38:22

577 Views

Generally, animation in JavaScript is done to get different effects and make the object move around the page. You can move and animate any type of HTML element using manual or automated animations in JavaScript. In this tutorial, we will learn how to differentiate between manual and automated animation in JavaScript. Manual Animation Before explaining the difference between the two common types of animation used in JavaScript, we must learn the process of animating objects manually. Under Manual Animation, the animation process is not automated. The following is the implementation of a simple animation using DOM object properties and ... Read More

Advertisements