Saturday, February 9, 2008

Including a Java Script File

<html>
<head>
<script type="text/javascript" src="file.js"></script>

</head>
</html>

Please don't use the shortcut <script type="text/javascript" src="file.js" />
This causes problems with Internet Explorer 6, which doesn't load the JavaScript page.

Once you include the javascript file, it executes automatically when you load the HTML file. You can also group the code in JavaScript functions, which only executes when called explicitly(This is what we will be doing most of the time).

0 comments: