NS + JS = BS

T

The Plankmeister

This:

document.getElementById("content_container").style["marginTop"] = 20;

works as expected in IE6 and O7. But not in NS7. Anyone know why?

P.
 
D

David Dorward

The said:
document.getElementById("content_container").style["marginTop"] = 20;
works as expected in IE6 and O7. But not in NS7. Anyone know why?

I think it should be .style.marginTop

but I KNOW that it should be "20px" not 20.
 
T

The Plankmeister

Sooperdooper! Works a treat! : )



David Dorward said:
The said:
document.getElementById("content_container").style["marginTop"] = 20;
works as expected in IE6 and O7. But not in NS7. Anyone know why?

I think it should be .style.marginTop

but I KNOW that it should be "20px" not 20.
 
G

Grant Wagner

The said:
This:

document.getElementById("content_container").style["marginTop"] = 20;

works as expected in IE6 and O7. But not in NS7. Anyone know why?

P.

Works fine in Netscape 7.1 and Mozilla/5.0 (Windows; U; Windows NT 5.0;
en-US; rv:1.5b) Gecko/20030909, so I'd suspect it's something called a "bug"
<url:
http://searchsecurity.techtarget.com/sDefinition/0,,sid14_gci211714,00.html
/>.

You may want to try setting the style property as a string, complete with
units since that's what "marginTop" actually is:

document.getElementById("content_container").style["marginTop"] = "20px";

--
| Grant Wagner <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-developer/upgrade_2.html
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top