Using an External JavaScript

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.

To use the external script, point to the .js file in the src attribute of the <script> tag as shown:

<html>
<head>
<script type="text/javascript" src="xxx.js"></script>
</head>
<body>
</body>
</html>
Share on Google Plus

About rourn vireak

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments:

Post a Comment