External .JS file

R

RICHARD BROMBERG

I have a simple program to test using an external .js file.
This external file contains some functions that I need to call from several html programs.
The program as written below works fine.
1. <html>
2. <head>
3. <meta http-equiv="Content-Language" content="en-us">
4. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
5. <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
6. <meta name="ProgId" content="FrontPage.Editor.Document">
7. <title>External .JS file Test</title>
8. </head>
9. <body>
10. <p>Program running</p>
11. <SCRIPT LANGUAGE="JAVASCRIPT" type="text/javascript" >
12. document.write("Hello")
13. </SCRIPT>
14. </body>
15. </html>

When I change line number 11 to refer to an external .js file (see code below) then the program fails.

<SCRIPT LANGUAGE="JAVASCRIPT" type="text/javascript" "src=myfunctions.js" >



I also tried using the full path to the .js file, no help.
The external .js file contains some functions that will be called from several html programs. Any idea what is wrong with this code?


Thanks





Thanks
 
D

Darko

Now, what seems wrong, and could a simple HTML validator tell you?

OK, let's help the man instead of being sarcastic:
error #1: you need to say argument="value", not "argument=value" - so,
we need <script ... src="myfunctions.js">
error #2: you didn't close the <script> tag - so you need to have it
like (and summarizing here):
<script language="javascript" type="text/javascript"
src="myfunctions.js"></script>
 
R

Randy Webb

Darko said the following on 6/19/2007 2:19 PM:
OK, let's help the man instead of being sarcastic:
error #1: you need to say argument="value", not "argument=value" - so,
we need <script ... src="myfunctions.js">
error #2: you didn't close the <script> tag - so you need to have it
like (and summarizing here):
<script language="javascript" type="text/javascript"
src="myfunctions.js"></script>

Error #3: The validator will tell you that the language attribute is
deprecated. It can also, in some circumstances, cause unwanted side
effects - especially if given javascript1.2 as the language.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top