473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

refering to a external JavaScript File in HTML

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
2 1384

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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: George Ziniewicz | last post by:
.. I have an html file with javascript functions in the <head> section that work fine when called from events or instanced as objects. When I move the functions to an external js file they don't...
9
by: Charley Kyd | last post by:
I'm a newbie who needs advice about how to use external files of JavaScript code. I spent an hour this afternoon browsing through JavaScript books at the local book store. In about 15 different...
5
by: kinne | last post by:
Is it possible to pass a parameter to an external ".js" file? Kinne
17
by: CES | last post by:
All, I was wondering if their is a way of loading an external script fill from within a script?? <script language="javascript" type="text/javascript"> function test(var){ <script...
1
by: mb | last post by:
Hi, I picked up this JavaScript code (quiz code) at: http://javascript.internet.com/miscellaneous/multiple-choice-quiz.html and modified it (and may have deleted some line I shouldn't have) so...
5
by: althafexcel | last post by:
hi everyone Im trying to include an external js in my aspx page under the head tag, it doesn't load or it displays an object expected error whenver the function from the .js is called. Actually...
1
by: Brian Kendig | last post by:
I've got some questions about using an external javascript file, included via '<script type="text/javascript" src="mycode.js" ></ script>': (1) If I define a function "myFunction()" in the...
3
by: RICHARD BROMBERG | last post by:
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. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.