View Full Version : [help] how to embed a .js file inside html?

04-09-2003, 07:56 AM
ok i have this problem with embedding a .js file inside the header file of HTML..I don't know whether to use ..

<script language="javascript" href="file.js"></script>


<script language="javascript" src="file.js"></script>



thanks in advance.^^


04-09-2003, 08:11 AM
<script type="text/javascript" language="javascript" src="myJsFile.js"></ script>

you could specify the js version...


...to make sure an ancient browser doesnt throw an error because it (e.g NN2 :) ) cant access an external file. I doubt many people bother with it now.
You can also specify js language versions for (somewhat) later browser versions to prevent them reading scripts with code they wont understand....as i say, im not sure that many people bother with it though.

04-09-2003, 10:35 AM

what purpose does this serve? I have a lot of external javascript activity on websites I designed. is there someone who isn't able to view my stuff if this isn't there?

04-09-2003, 11:28 AM
No (well not in the near future anyway), the type="text/javascript' is required by the HTML standard for the Script Element (http://www.w3.org/TR/html401/interact/scripts.html#edef-SCRIPT)

The 'language' attribute is deprecated (http://www.w3.org/TR/html401/conform.html#deprecated) in place of the 'type' atribute.

04-09-2003, 08:28 PM
what versions of javascript are there?? because i was reading some books about it..and they just say most browser will recognize the term "javascript" .. so please help me :^)

by the way, thanks for the help! i realized that problem is not that part..it's something else deep within the code itself. thanks tho!


04-09-2003, 08:39 PM
Have a look at this thread - http://www.codingforums.com/showthread.php?s=&threadid=15703