kaeli <ti******@NOSPAM.comcast.net> writes:
As a workaround and only if only IE and NN7 are the only browsers, the
following will work. (note: opera supports document.all)
Some versions of Opera. Some of them only sometimes. And so several
other browsers too.
if (document.all)
{
// IE
Bad idea. As you say, it works if the *only* browsers they will view
the page are the *currently avilable* versions of IE and Mozilla.
Most other current browsers, and potentially a lot of future browsers,
will fail. So, don't go there, it's bound to come back and bite you in
the posterior.
The best way (IMNSHO[1]) is to
1) Use a doctype that triggers standards mode. That will let IE 6 show
the page according to the CSS 1 standard, instead of being bugwards
compatible with the highly deprected IE 4. In most cases, IE 6 and
Mozilla (and Opera and other standards supporting browsers) will then
show the pages identically.
I would use HTML 4.01 with en URL. Read more:
<URL:http://msdn.microsoft.com/library/en-us/dnie60/html/cssenhancements.asp>
<URL:http://mozilla.org/docs/web-developer/quirks/doctypes.html>
<URL:http://www.opera.com/docs/specs/doctype/>
2) Where the browsers still differ in rendering, make the page so that
it looks correct in Mozilla. Then add the changes needed to make it
look the same in IE, but wrap them in IE's conditional comments:
<!--[if IE]> blah blah fixes IE blah <![end if]-->
To all other browsers, it looks like a comment. To IE 5+, it is treated
as normal content.
<URL:http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp>
Normally, those two steps will be enough to fix any problems you might
have with IE.
/L
[1] in my, not so humble, opinion.
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'