NS + JS = BS

Discussion in 'Javascript' started by The Plankmeister, Sep 10, 2003.

  1. This:

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

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

    P.
     
    The Plankmeister, Sep 10, 2003
    #1
    1. Advertising

  2. The Plankmeister wrote:
    > 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.


    --
    David Dorward http://dorward.me.uk/
     
    David Dorward, Sep 10, 2003
    #2
    1. Advertising

  3. Sooperdooper! Works a treat! : )



    "David Dorward" <> wrote in message
    news:bjo2ja$dp$1$...
    > The Plankmeister wrote:
    > > 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.
    >
    >
    > --
    > David Dorward http://dorward.me.uk/
     
    The Plankmeister, Sep 10, 2003
    #3
  4. The Plankmeister

    Grant Wagner Guest

    The Plankmeister wrote:

    > 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 <>

    * 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
     
    Grant Wagner, Sep 11, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page