NS v. IE

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lee Davidson

    NS v. IE

    I can move a couple of layers in IE, but they are not moving in NS.
    What is wrong with this?

    if (NS4)
    {
    document.word1. left = mv1From;
    }
    else if (NS6)
    {
    document.getEle mentById('word1 ').style.left = mv1From + "px";
    }
    else if (IE)
    {
    document.all.wo rd1.style.left = mv1From + "px";
    }

  • Lee Davidson

    #2
    Re: NS v. IE

    Thanks for your response. The objects are:

    <div id=word1 style="position :absolute; z-index=3; Left=0; top=5">
    <SCRIPT LANGUAGE="javas cript">
    document.write( "'04 election in:");
    </SCRIPT>
    </div>

    <div id=word2 style="position :absolute; z-index:2; Left=90%; top=5">
    <SCRIPT LANGUAGE="javas cript">
    document.write( days + " Days")
    </SCRIPT>
    </div>

    or actually divisions, not layers. I was lazily using a generic name.
    Sorry for the confusion.

    I had printed the values to the screen so I know the various flags are
    set correctly (at least NS6 and IE) as I'm using NS7.

    I doubt many people are using NS4 anymore, but I left that in just
    because it wasn't hurting anything.

    I used your wonderful page (please keep it around a while) to see that
    document.body.c lientWidth returns the value in both IE and NS. But when
    I try to display it with an alert box:

    <BODY onload="init()" >

    <script>

    var scrWidth = document.body.c lientWidth;
    alert("sw " + scrWidth);

    it comes up as 0. So all the math is failing and the move not reached.
    I do see the proper number when your page is displayed in NS so I
    know the browser does see the width.

    Now you know why I'm losing my hair.

    Lee

    Comment

    • Markus Ernst

      #3
      Re: NS v. IE


      "Lee Davidson" <jerry_davdison @compuserve.com > schrieb im Newsbeitrag
      news:3EFC5CB7.8 0205@compuserve .com...[color=blue]
      > Thanks for your response. The objects are:
      >
      > <div id=word1 style="position :absolute; z-index=3; Left=0; top=5">
      > <SCRIPT LANGUAGE="javas cript">
      > document.write( "'04 election in:");
      > </SCRIPT>
      > </div>
      >
      > <div id=word2 style="position :absolute; z-index:2; Left=90%; top=5">
      > <SCRIPT LANGUAGE="javas cript">
      > document.write( days + " Days")
      > </SCRIPT>
      > </div>
      >[/color]

      The correct syntax for the inline css is:

      style="position :absolute; z-index:3px; left:0px; top:5px"

      --
      Markus


      Comment

      • Lasse Reichstein Nielsen

        #4
        Re: NS v. IE

        Lee Davidson <jerry_davdison @compuserve.com > writes:
        [color=blue]
        > Thanks for your response. The objects are:
        >
        > <div id=word1 style="position :absolute; z-index=3; Left=0; top=5">[/color]

        Typos in the CSS, you use "=" where you should use ":" and you
        have forgotten the units on the value of top, i.e.,

        <div id=word1 style="position :absolute;z-index:3;left:0p x;top:5px">
        [color=blue]
        > <SCRIPT LANGUAGE="javas cript">[/color]

        Should be
        <script type="text/javascript">
        In HTML 4, the type attribute is mandatory and the language attribute
        is deprecated.
        [color=blue]
        > document.write( "'04 election in:");
        > </SCRIPT>
        > </div>
        >
        > <div id=word2 style="position :absolute; z-index:2; Left=90%; top=5">[/color]

        As above. You might want to change "left:90%" to "right:0px" .
        [color=blue]
        > <SCRIPT LANGUAGE="javas cript">[/color]

        As above
        [color=blue]
        > document.write( days + " Days")[/color]

        I assume the "days" variable is initalized earlier.
        [color=blue]
        > </SCRIPT>
        > </div>
        >
        > or actually divisions, not layers. I was lazily using a generic name.
        > Sorry for the confusion.[/color]

        Many people say "layers" about absolutely positionend block elements.
        I try to make them stop, partly because it can be confuzed with the
        <layer> tag, but mostly because it makes people think that there is
        something special about the positioned block. In CSS, it's just a
        block like any other.
        [color=blue]
        > I had printed the values to the screen so I know the various flags are
        > set correctly (at least NS6 and IE) as I'm using NS7.[/color]

        Ok.
        [color=blue]
        > I doubt many people are using NS4 anymore, but I left that in just
        > because it wasn't hurting anything.[/color]

        As long as it isn't used for anything but NS4, it shouldn't be a
        problem.
        [color=blue]
        > I used your wonderful page (please keep it around a while) to see that
        > document.body.c lientWidth returns the value in both IE and NS. But
        > when I try to display it with an alert box:[/color]
        [color=blue]
        > <BODY onload="init()" >
        >
        > <script>[/color]

        type="text/javascript"

        (yes, I'm pedantic :)
        [color=blue]
        > var scrWidth = document.body.c lientWidth;
        > alert("sw " + scrWidth);
        >
        > it comes up as 0.[/color]

        I can't explain (or reproduce) that. Do you have a link to the page?

        Does the page set the broweser in Quirks mode or Standards mode? I
        test the values in Standards mode (the only mode one should write new
        pages for!), and it might make a difference.

        Some value are not initialized until the page is loaded, or at least
        contains some content. Your example here gets
        document.body.c lientWidth before any content is added to the body. I
        don't think it matters, it's the height that has that problem, not the
        width.

        I don't think that is the problem, though (can't reproduce a problem
        with it in either Standards or Quirks mode.)
        [color=blue]
        > So all the math is failing and the move not reached. I do see the
        > proper number when your page is displayed in NS so I know the
        > browser does see the width.[/color]

        I'm pretty stumped too. Could you give a link to the page, so I can
        see it live?
        [color=blue]
        > Now you know why I'm losing my hair.[/color]

        I hear testosterone will do that to you. That's my excuse :)

        /L
        --
        Lasse Reichstein Nielsen - lrn@hotpop.com
        Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
        'Faith without judgement merely degrades the spirit divine.'

        Comment

        • Lee Davidson

          #5
          Re: NS v. IE

          First, thanks for the help (and Markus that applies to you as well).

          Second, I think the lack of objects on the page must have been the
          problem as both browsers showed your wonder test page just fine. I
          switched from "body" to "documentElemen t" and it picked up the size.

          Third, I have no idea what "Quirks" mode is.

          The working page is www.democratsforum.com and the testing page is
          www.democratsforum.com/textframe.htm. I put in an "alert" and in IE the
          document.body.c lientWidth shows as expected, but not in NS.
          Yet it does show when printed to the page as in your test position page.

          Anyway, it looks as if this is working now (perhaps not in Opera). I
          have a friend that uses that one and will ask him to check it out.

          Lee

          Comment

          Working...