...

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



fat1615
04-09-2003, 06: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>

or

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

or

neither.


thanks in advance.^^

~fat~

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


you could specify the js version...

language="javascript1.1"

...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.

Beck
04-09-2003, 09:35 AM
type="text/javascript"

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?

HairyTeeth
04-09-2003, 10: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.

fat1615
04-09-2003, 07: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!

~fat~:cool:

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum