javascript would fail to create a html element sometimes

Q

q2005

Hi, all

I have a very simple page and on the page there is a small javascript to
create a html element. On one of my PC's runs no problem, the page is
displayed and the created element is there. While on the other of my PC's
(3) the javascript won't create the HTML element. I used an alert() just
before it creates the element and I found the difference. On the right PC,
when alert() prompted the page was already half done on the screen. On the
others, when alert() prompted there was nothing about the page displayed on
the screen. How do I set the IE to display and run javascript at the same
time, just like the right PC? thank you very much!

OS win xp
IE v6.0

Jack
 
R

RobG

q2005 said:
Hi, all

I have a very simple page and on the page there is a small javascript to
create a html element. On one of my PC's runs no problem, the page is

Some code? URL?

[...]
before it creates the element and I found the difference. On the right PC,
when alert() prompted the page was already half done on the screen. On the
others, when alert() prompted there was nothing about the page displayed on
the screen. How do I set the IE to display and run javascript at the same
time, just like the right PC? thank you very much!

Sounds like your JS refers to something in the HTML that hasn't been
created by the time your JS runs - is the script before the element it
modifies? The content of your page is executed as the browser reads
it, it doesn't wait until everything is loaded.

Either fire your script from an onload= or move it lower down the page.
 

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

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top