Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

#include with client-side javascript - WEIRD problem

Status
Not open for further replies.

4waystop

Programmer
Aug 30, 2004
19
GB
Hi

I've got two pages, one page which I want to show to the client and another page whose sole purpose it is to house a bunch of client-side javascript functions. I'm trying to include this page with javascript functions in the page which I want to show the client.

The problem is that although the code shows up if you view the source, the browser does not seem to recognise any of the functions in the javascript page and as a result is completely unwilling to execute them. Instead it throws an error: "Object Expected".

I've tried
Code:
<!-- #include file ="include\clientfunctions.asp" -->
as well as
Code:
]<!-- #include file ="include\clientfunctions.js" -->
Obviously I renamed the file as well.

Please Help!
4waystop
 
Are there appropriate SCRIPT tags in the included file, or wrapped around the #include statement?
 
if there's code that executes within the includes, you might be throwing an error on that code and not the include statement, sometimes when using an include, all code in the include sometimes will return an error on the include line instead of a line number in the include itself

[thumbsup2]DreX
aKa - Robert
 
The include file has <script lang...> ... </script> tags within itself. I've tried including it in various places - before and after the head and within the body.

The error is not being returned on the include line. Its being returned by a call to a method within the include. I call a function using
Code:
check();
and then I get an "Object expected" error pointing to this line.
 
This probably sounds dumb ("Is the printer plugged in, sir?"), but have you pasted the included file in over the include and tested the page, just to make sure that something didn't get messed up along the way?
 
Haha just done that! Yeh well I was just coming back here to tell you guys not to worry - I don't really know what this issue was, but some typo I guess. Cut and pasted it out, tested then cut and pasted back and now it works. Who knows?! Thanks for your suggestions, but sorry for wasting your time.
4waystop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top