• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

External Javascript

[lhomme]

New Member
Suppose I have want to use a time and date javascript and I wish to have it in a seperate file. On the file I want the javascript to be included it I inserted

<script language="JavaScript" src="timedate.js"></script>

where timedate.js is the name of the file and in timedate.js I have

<script language="JavaScript" type="text/javascript">
Script Here
</script>

Somebody is wrong with the above but what is it?

edit: never mind - i did some experimentation and figured out my problem. its nice of IE to give totally misleading error information.
 
Last edited:
This part:
<script language="JavaScript" type="text/javascript">
</script>
is HTML, not Javascript. You should have only the js code in the js file. No tags, no HTML comments, no HTML nothing.

Same with CSS. No STYLE tags or HTML comments in an CSS file.

<ooops!>
I didn't see that you had edited - anyway, if you have those tags in there IE isn't wrong.
 
Last edited:
just another thing from your favorite code nazi:
Is should be:
<script type="text/javascript" src="timedate.js"></script>
The language="Javascript" is the old way (pre HTML 4) of doing it!
 
The way you have it (but in the wrong place :p) with both attributes:
language="JavaScript" type="text/javascript

is actually pretty usual for backward compatibility. Can't use "language" with (X)HTML Strict though.
 
Back
Top