src variable - using an external JavaScript

  • JavaScript can also be placed in external files. External JavaScript files often contain code to be used on several different web pages. External JavaScript files have the file extension .js.
  • You can use attribute src to include an external file containing JavaScript code:<script language="JavaScript" src="hello.js"></script>
  • For example, shown below is the code of the external file hello.js
         document.write("Hello World!")
Note: External script cannot contain the <script> and </script> tags!

0 comments :

Post a Comment

> Related Posts with Thumbnails
 

Copyright © 2012. GS dot net - All Rights Reserved - Design by BTDesigner - Proudly powered by Blogger