
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Use the Same JavaScript in Multiple Content Pages
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.
<html> <body> <form> <input type="button" value="Result" onclick="display()"/> </form> <script src="demo.js"> </script> </body> </html>
Advertisements