View Full Version : Javascript.js file problem
greg59
01-30-2003, 08:28 AM
I was told,
you can place the link to a javascript .js file in similar fashion to a css page in your html document.
by doing
<SCRIPT SRC="javafile.js">
So I took my javascript and made a file called,
law.js..........
then in my html page I place
<SCRIPT SRC="law.js">
Now I have had this script in 5 pages and all work fine but
when I tried the above I get an error, am I not doing something right or do you want more information?
TIA!
Android
01-30-2003, 09:31 AM
<SCRIPT LANGUAGE="javascript" SRC="law.js"></SCRIPT>
in the head.
I'm not a pro at javascript, but it's my guess that you need the language attribute.
greg59
01-30-2003, 11:41 AM
Android,
Thanks;) , You helped me a bunch!
I was not putting <SCRIPT LANGUAGE="javascript" ..in
the html page because I had it in the file well when I
first tried your suggestion I still got an error, so
I relooked at the law...file and decided to take out
the tags in the file.
One other comment for anyone who might read this
I did not have to put...<SCRIPT LANGUAGE="javascript" SRC="law.js"></SCRIPT> in header for it to work....
it will run any place on the page.
Thanks again
kdjoergensen
01-30-2003, 05:30 PM
the external library file (filename.js) must not have any tags in it. e.g. <script> tags should be in the HTML file and NOT in the library file.
example:
in page:
<script language="javascript">
<!-- hiding from old browsers
alert('hello');
//-->
</script>
external:
<script language="javascript" src="ext.js"></script>
In external 'ext.js' file:
<!-- hiding from old browsers
alert('hello'); // no script tags in this file
//-->
The complete command should actually be:
<script language="javascript" src="law.js" type="text/javascript"></script>
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.