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

refering to a external JavaScript File in HTML

P: n/a
Hi...,

I removed all the JavaScript code & put it in a file called abc.js from
a HTML page. Now I tried to refer it in the HTML page like this :

<script src="abc.js" type="text/javascript">
</script>

It gives me "Object Expected" error. Where should the abc.js reside in
the Web Project.

Regards,

Praveen

Jan 11 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a

praveenmmoha...@gmail.com wrote:
Hi...,

I removed all the JavaScript code & put it in a file called abc.js from
a HTML page. Now I tried to refer it in the HTML page like this :

<script src="abc.js" type="text/javascript">
</script>

It gives me "Object Expected" error. Where should the abc.js reside in
the Web Project.
That depends on what your script does. Judging from your error
message, you're using IE. Using Firefox will give you better error
messages most of the time.

Was it working before you moved it to an external javascript file? If
so, then yes, it should be just a matter of placing it in the correct
location. Preferably in the same area where you removed your script.

If not, then you need to debug your script.

Jan 11 '07 #2

P: n/a
pr*************@gmail.com wrote:
>I removed all the JavaScript code & put it in a file called abc.js from
a HTML page. Now I tried to refer it in the HTML page like this :

<script src="abc.js" type="text/javascript">
</script>

It gives me "Object Expected" error. Where should the abc.js reside in
the Web Project.
The rules are the same as for other relative URLs -- for example images.
So, with no BASE tag specified: right next to the html file.

It sounds to me like the file (probably) is loaded, but something is
wrong in it. You won't get this kind of error message just because the
file isn't found.

--
Bart.
Jan 12 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.