By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,876 Members | 1,206 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,876 IT Pros & Developers. It's quick & easy.

External .JS file

P: n/a


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
Jun 19 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Rik
On Tue, 19 Jun 2007 19:40:00 +0200, RICHARD BROMBERG <no*****@att.net
wrote:
"src=myfunctions.js"
Now, what seems wrong, and could a simple HTML validator tell you?
--
Rik Wasmus
Jun 19 '07 #2

P: n/a
On Jun 19, 8:01 pm, Rik <luiheidsgoe...@hotmail.comwrote:
On Tue, 19 Jun 2007 19:40:00 +0200, RICHARD BROMBERG <nore...@att.net>
wrote:
"src=myfunctions.js"

Now, what seems wrong, and could a simple HTML validator tell you?
--
Rik Wasmus
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 <scripttag - so you need to have it
like (and summarizing here):
<script language="javascript" type="text/javascript"
src="myfunctions.js"></script>

Jun 19 '07 #3

P: n/a
Darko said the following on 6/19/2007 2:19 PM:
On Jun 19, 8:01 pm, Rik <luiheidsgoe...@hotmail.comwrote:
>On Tue, 19 Jun 2007 19:40:00 +0200, RICHARD BROMBERG <nore...@att.net>
wrote:
>>"src=myfunctions.js"
Now, what seems wrong, and could a simple HTML validator tell you?
--
Rik Wasmus

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

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 19 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.