By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,327 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

javascript would fail to create a html element sometimes

P: n/a
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
Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
q2005 wrote:
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.

--
Rob
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.