Strange javascript include problem?

H

Harry

I have a script file called "common.js" containing various JS functions -
while this file resides in the same directory as the JSP files it's fine but
trying to tidy it up by moving it in to a sub-directory called "include"
under the JSP dir & changing the line in my JSP files to -

<script type="text/javascript" language='javascript 1.2'
src="include/common.js"></script>

it doesn't work - keep getting "object required" message boxes when
viewing/clicking the page!

Any ideas why this might happen? - do you always perhaps have to have
include files in the same directory as the JSP files?

thanks

harry
 
J

Jerry Park

Harry said:
I have a script file called "common.js" containing various JS functions -
while this file resides in the same directory as the JSP files it's fine but
trying to tidy it up by moving it in to a sub-directory called "include"
under the JSP dir & changing the line in my JSP files to -

<script type="text/javascript" language='javascript 1.2'
src="include/common.js"></script>

it doesn't work - keep getting "object required" message boxes when
viewing/clicking the page!

Any ideas why this might happen? - do you always perhaps have to have
include files in the same directory as the JSP files?

thanks

harry
The language="javascript 1.2" has been deprecated and probably shouldn't
be used.

Since include is a subdirectory, I'd try like this:

<script type="text/javascript" src="/include/common.js"></script>
 
H

Harry

Thanks & tried that & no difference - think I might just have to settle for
keeping it in the same directory!
 
H

Harry

A bit of a sily question, but when the included file is cached by the
browser does it get vaidated to make sure all objects
referenced within all the JS functions exist? - reason I ask is I'm now
getting "object not found" errors, commenting out those objects in the JS
functions (ones that are not called!) & it works! - spooky or what!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,099
Messages
2,570,626
Members
47,237
Latest member
David123

Latest Threads

Top