- 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 10711 Articles for Web Development
![Rahul Sharma](https://www.tutorialspoint.com/assets/profiles/14297/profile/60_102977-1513054044.jpg)
1K+ Views
To use the same JavaScript in more than one page, add the js code in an external JavaScript file. Let’s say the following demo.js is our external JavaScript file −function display() { alert("Hello World!"); }Now add the external JavaScript file to the following HTML web page. In the same way, you can add it to multiple content page.
![Johar Ali](https://www.tutorialspoint.com/assets/profiles/14293/profile/60_101691-1513053093.jpg)
283 Views
Let’s say the following line we have in our HTML −Here the browser identifies inline JavaScript by detecting onclick, even when tag wasn’t available.The following are some of the suggestions for using inline JavaScripts −You should consider inline script elements such as ...) if the script only to be used for a single page.Do not use event attributes such as onclick="...", and bind event handlers using JavaScript.Use external script elements such as ) for most scripts, especially if reused between pages.
![Amit Sharma](https://www.tutorialspoint.com/assets/profiles/14294/profile/60_103411-1513053466.png)
184 Views
JavaScript’s automatic semicolon insertion (ASI) is to insert missing semicolons. The following statements are affected by automatic semicolon insertion −empty statement var statement expression statement do-while statement continue statement break statement return statement throw statementThe rules are in the following specification −When, as a Script or Module is parsed from left to right: A token is encountered that is not allowed by any production of the grammar, then a semicolon is automatically inserted before the offending token only if one or more of the following conditions becomes true −Offending token is }.Previous token is ) and the inserted semicolon would ... Read More
![Ali](https://www.tutorialspoint.com/assets/profiles/14292/profile/60_101553-1513052445.jpg)
2K+ Views
It’s always a good practice to add jQuery code in footer i.e. just before the closing tag. If you have not done that, then use the defer attribute.Use defer attribute so the web browser knows to download your scripts after the HTML downloaded −The defer attribute is used to specify that the script execution occurs when the page loads. It is useful only for external scripts and is a boolean attribute.ExampleThe following code shows how to use the defer attribute − The external file added will load later, since we're using defer
![Rahul Sharma](https://www.tutorialspoint.com/assets/profiles/14297/profile/60_102977-1513054044.jpg)
155 Views
To disable resizable property, use CSS style −textarea { resize: none; }To disable specific textarea with different attribute values, try the following. Let’s say the attribute is set to “demo” −textarea[name=demo] { resize: none; }Let’s say the id attribute is “demo” −For the above,#demo { resize: none; }
![Johar Ali](https://www.tutorialspoint.com/assets/profiles/14293/profile/60_101691-1513053093.jpg)
78 Views
Nowadays, almost every web browser supports JavaScript. If it is turned off, you can use tag. To let users know about non-JavaScript web browsers, use the tag. The HTML tag is used to handle the browsers, which do recognize tag but do not support scripting. This tag is used to display an alternate text message.Example HTML noscript Tag Your browser does not support JavaScript!
![Amit Sharma](https://www.tutorialspoint.com/assets/profiles/14294/profile/60_103411-1513053466.png)
10K+ Views
Both onclick & href have different behaviors when calling JavaScript directly. Also the script in href won’t get executed if the time difference is short. This is for the time between two clicks.ExampleHere’s an example showing the usage of href vs onClick in JavaScript. Live Demo JavaScript href vs onClick() function myFunc() { var v = 0; for (var j=0; j
![Swarali Sree](https://www.tutorialspoint.com/assets/profiles/13515/profile/60_84115-1512649510.jpg)
5K+ Views
The scope of a variable is the region of your program in which it is defined. JavaScript variables have only two scopes.Global Variables − A global variable has a global scope which means it can be defined anywhere in your JavaScript code.Local Variables − A local variable will be visible only within a function where it is defined. Function parameters are always local to that function.Within the body of a function, a local variable takes precedence over a global variable with the same name. If you declare a local variable or function parameter with the same name as a global ... Read More
![Rahul Sharma](https://www.tutorialspoint.com/assets/profiles/14297/profile/60_102977-1513054044.jpg)
885 Views
Like many other programming languages, JavaScript has variables. Variables can be thought of as named containers. You can place data into these containers and then refer to the data simply by naming the container.Before you use a variable in a JavaScript program, you must declare it. Variables are declared with the var keyword as follows. You can also declare multiple variables with the same var keyword as follows − Storing a value in a variable is called variable initialization. You can do variable initialization at the time of variable creation or at a later point in ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
1K+ Views
document.onloadIt gets fired prior to loading of images and other external content. document.onload event is fired before the window.onload.window.onloadIt gets fired when the complete page loads, which includes images, scripts, css, etc.ExampleHere’a an example to understand onload.Live Demo JavaScript Animation Click button below to move the image to right