Click to See Complete Forum and Search --> : How can page events call external functions?


karayan
07-23-2003, 01:37 AM
I need to have all my javascript in an external file, so I load it with:

<script src=....>

The trouble is, events in the HTML page (like onLoad for the body tag) reference functions that are included in the external js file. So, IE complains. Even when I moved the above <script> tag in the <header> island, it still complains. So, how do I reference these functions as external?

Thanks.

George

requestcode
07-23-2003, 06:44 AM
It should not be any different then if they were in your document. What type of error are you getting?

Charles
07-23-2003, 06:46 AM
You are making some kind of mistake. Please post the URL.

karayan
07-23-2003, 10:54 AM
The error I am getting is "Object expected" on the following line of the HTML file:

<body bgcolor="#e5d4b6" onLoad="AWS_start()">


I assumed that it cannot find the AWS_start() "object."

AWS_start() is a function in my exterbal script. When the script was not external, but imbedded in the HTMl file, I did not used to get the error.

Sorry, I cannot post the whole file, as it is proprietary.

Charles
07-23-2003, 12:05 PM
Originally posted by karayan

Sorry, I cannot post the whole file, as it is proprietary.And I'm equally sorry that I am unable to help you.

AdamBrill
07-23-2003, 12:39 PM
Since if everything that you are saying would be correct it would work fine, you must have some error in your code. Without being able to see the entire page, it would be blind guessing to find the problem. About the only thing that I can think of without seeing it is make sure that you are attaching the correct external script.

karayan
07-23-2003, 02:56 PM
<blush>
I figured it out. I was just trying to load the js file from the wrong directory. The description of the error conditions in my posting above was wrong.
</blush>

You would think that <script> would throw an error if it couldn't find the js file to load. <b>sigh</b>

Thanks for your help, guys.

George