View Full Version : Short question: Code in SRC of a .js not working

04-01-2003, 03:44 PM
Hi. The problem: I have a .html page and there, via src="base.js",
i am fetching some javascript of it.
Now the JS code in particular involves document and submit and is short. (after the function name, its document.formular5.submit(); )

If i put the JS in the .html page via
<script language="javascript">

it works.
If I put it into a .js file, it no longer works.
I would like to get it to work because I will have to rely on this JS code for several html-pages and adding JS into each html page is not how i would like to see this solved.

I suspect that something either with the submit or the document is not correct (in the .js file).

If someone would have an idea what could be wrong ?

04-01-2003, 04:26 PM
If the code is identical, the problem could be that you have <script> </script> tags in your base.js file. There should'nt be any. Just the content of the javascript itself.

04-01-2003, 04:56 PM
Thanks for the reply. I haven't put </script> tags into the .js file anywhere, no < > at all actually. What is strange, a slightly different version of the script works fine in another .html page.
Guess something is bugged with my software :)

But anyway, can I refer from the .js file to a specific .html page ?

Like open a new .html page (from the .js file) and applying a change to this newly opened .html page lateron ?

I remember that I have had some problems to add huge
javascript code into .js file some months ago.

04-01-2003, 05:23 PM
can we see the code, or a link to the page this is on?