Evertjan. said:
David Dorward wrote on 08 okt 2003 in comp.lang.javascript:
I think you should see my code as a pointer in the
right direction.
That assumes it is the right direction. The OP's problem seems to be the
progressive rendering of HTML so there might be HTML structures that
could be used on the page that would prevent the browser from doing
progressive rendering. That would of course be a question best addressed
to an HTML group but if it can be done then the JavaScript dependency
would become totally avoidable.
Of cource you can improve on it by also hiding the
div by javascript in the <head> section.
Except that it is not quite as simple as just using JavaScript to
document.write a style element in to the head section as some browsers,
even with JavaScript enables, just cannot switch the CSS display
property of an element with JavaScript so the browser's support for that
ability would have to be ascertained prior to the writing of the style
element. (and directly setting style.display = 'none'; in the head won't
work because the DIV would not exist at that point).
Personally I always use getElementById.
Then why do you frequently post code that assumes IDs will be global
properties?
Again, I think code given in this NG should be NOT used
"copy, paste and no need to understand",
There is considerably more to Internet browser scripting than just
writing code, so providing copy-n-paste code without explanation would
be doing nobody any favours. If posted code has issues then it has got
to be worth mentioning them.
but just showing that it can be done.
Consider the not infrequently enquired about desire to read and write
files on the user's computer over the Internet. It can be done and the
code to do it could be posted, but there are so many ifs associated with
attempting to do it that in practice it is impractical.
There is a big difference between what can be done and what should be
done, especially when what can be done can only be done on one browser
in a very specific configuration.
Furthermore it is the personal choice of the page builder,
if he wants to accommodate for non-IE browsers and for
javascript off. [Or only for NS, for that matter] That
does not mean I think it a bad thing that you warn for
these matters in my code. You are welcome to do that.
It should not really be necessary for other people to be pointing out
issues with your code. But because you author exclusively for JScript
enabled default configurations of IE running on default configurations
of Windows OSs and don't even consider the alternative, you are just
unaware of most of the issues associated with the code you post to this
group.
Obviously that is your decision but as the default assumption for this
group is that questions asked relate to cross-browser scripting for the
Internet (unless stated otherwise, as noted in the FAQ) much higher
standards than yours are expected here.
Of course the simplest solution would be for you to add the caveat that
to the best of your knowledge all the code you post will only work
successfully on JScript enabled default configurations of Windows IE (or
whatever more specific warning best describes your situation), and leave
it to the OP (and others) to judge what value to place on the
accompanying contribution for themselves.
Richard.