If you want to run the same JavaScript on several pages, without having to write the same script on every page, you can write a JavaScript in an external file. Save the external JavaScript file with a .js file extension.
Note: The external script cannot contain the <script></script> tags!
To use the external script, point to the .js file in the “src” attribute of the <script> tag:
Example:
<html>
<head>
<script type=”text/javascript” src=”xxx.js”></script>
</head>
<body>
</body>
</html>
Note: Remember to place the script exactly where you normally would write the script!
Related
This is author biographical info, that can be used to tell more about you, your iterests, background and experience. You can change it on Admin > Users > Your Profile > Biographical Info page."
About us and this blog
We are a digital marketing company with a focus on helping our customers achieve great results across several key areas.
Request a free quote
We offer professional SEO services that help websites increase their organic search score drastically in order to compete for the highest rankings even when it comes to highly competitive keywords.
Subscribe to our newsletter!
More from our blog
See all postsRecent Posts
- Is Search Engine Submission Necessary? April 17, 2014
- Can Any Inbound Linking Hurt My Ranking? April 17, 2014
- The Importance of Anchor Text in Back-links April 17, 2014
This site uses Akismet to reduce spam. Learn how your comment data is processed.