Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I had a javascript section at the end of my file, after the close of the body tag, which fills the innerHTML of one of my tags with a table. The code was working perfectly fine.
But then I wanted to move the script to a separate .js file, because I didn't want it accessible.
When I did so, the code simply stopped working.
I then moved the code inside the head, and got an error. I understand this: since the code was now before the body, I was attempting to access an object which had not yet been created.
So I put all the code inside a function and in the body statement, I put onload= followed by a call to that function.
The code is now working again.
The problem: Since the code is now not called until after all the .gifs are loaded, the page looks frightful until then.
So the types of solutions I'm looking for:
1. Is there an event earlier than onload?
2. Is there any way to refer to a .js file other than from the head?
3. Is there a way to create and fill an object before body?Anyone responses from someone who understands this problem and has a solution (any off-topic comments and/or questions will be ignored) would be welcome.
Thank you.

> 2. Is there any way to refer to a .js
> file other than from the head?Couldn't you just put:
[script src="script.js"][/script]
in place of the script?

Try the above. Also, you may want to consider preloading your images. This can be done quite easily with JavaScript.

![]() |
telnet automation
|
problems with lu and li
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |