Click to See Complete Forum and Search --> : Problem linking a Javascript file


Marcelo
09-27-2003, 08:24 AM
I'm linking a javascript file ".js" in my html pages, like this:

<script language="Javascript" src="../../functions.js"></script>

but when I access the page I receive the following message on my browser:

Error on page.

and the scripts inside the file don't work... (sintax error)

even I erase all functions in the file it keep not working.
I tryied to put the functions inside the html file and it's ok.

Someone know what is happening?

Thanks.

AdamBrill
09-27-2003, 08:30 AM
Are you sure that ../../functions.js is the correct path? That would mean that functins.js is in the directory two higher than the one that the script is in... Try putting functions.js into the same folder and see if it will work.

Khalid Ali
09-27-2003, 08:31 AM
interesting,you have a link to the page where you have this problem available?

Marcelo
09-27-2003, 08:37 AM
the js file path is correct... if I erase the js file the page doesn't return an error when opening...

I'm using asp to return the html code.

You can see the error on:
http://www7.faculdadepromove.br/academico/instituicao/coordenacao/default.asp

Thanks

Khalid Ali
09-27-2003, 08:42 AM
your problem is in the *.js file,
remove the html and asp code from it below and including this line

<!-- #INCLUDE FILE="conn.asp" -->

Make sure the file has only javascript code in it and no script tags in it

Marcelo
09-27-2003, 08:50 AM
there is no html and asp code in my js file.

http://www7.faculdadepromove.br/academico/funcoes.js

I used the name function.js, but the real name is funcoes.js.

thanks again.

Khalid Ali
09-27-2003, 08:53 AM
click on hte link you rovided and see your self,the file that opens has a tone of garbage other then javascript code.

Marcelo
09-27-2003, 09:06 AM
Sorry, you are right... but these scripts aren't in my original .js file, I'm sure. It appears only when the page is loaded from the asp page. It's very strange.

Shampie
09-27-2003, 09:14 AM
in a .js file you only put javascript (normally what you put within <javascript></javascript> tags when using in html file, though in a js file you do not need to put <javascript></javascript> tags because the file is fully read as js).

There is html in your file as stated above by others.
unless its for a document.write or other js function remove it.
The file works fine without the html-part.

Marcelo
09-27-2003, 09:20 AM
The original file (in my computer) doesn't contain any script.
It looks like a problem with IIS, because it occurs when someone access the page. I posted the file again and occorred the same error.

Khalid Ali
09-27-2003, 09:32 AM
so..you hve a crapy webserver problem..too bad,you can use apache webserver there is a module available for it that will allow you to serve asp files with apache..IIS is a piece of crappppppp
:D