Javascript block alters layout in IE

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

    Javascript block alters layout in IE

    I just noticed, in IE6, when navagating from one page to another with
    the same basic layout (centered top graphic, for example), that a page
    with a <script> block in the <head> shifts the HTML contents some number
    of pixels to the right.

    Other than putting a blank <script> block into each web page, or putting
    SCRIPT at the bottom of the BODY, any other way to work around this?

    Thanks
  • RobG

    #2
    Re: Javascript block alters layout in IE

    Steve wrote:[color=blue]
    > I just noticed, in IE6, when navagating from one page to another with
    > the same basic layout (centered top graphic, for example), that a page
    > with a <script> block in the <head> shifts the HTML contents some number
    > of pixels to the right.
    >
    > Other than putting a blank <script> block into each web page, or putting
    > SCRIPT at the bottom of the BODY, any other way to work around this?
    >
    > Thanks[/color]

    Post an example or link to one. It's really a CSS question, but I'm
    happy to play along...


    --
    Rob

    Comment

    • Nathan

      #3
      Re: Javascript block alters layout in IE

      > Other than putting a blank <script> block into each web page, or putting[color=blue]
      > SCRIPT at the bottom of the BODY, any other way to work around this?[/color]

      [color=blue]
      > Thanks[/color]

      If at all possible, put it inside the <head> block. Then call it from
      the HTML by attaching a trigger (such as onmouseover or onclick).

      Comment

      • Steve

        #4
        Re: Javascript block alters layout in IE

        RobG <rgqld@iinet.ne t.auau> wrote:
        [color=blue]
        >Steve wrote:[color=green]
        >> I just noticed, in IE6, when navagating from one page to another with
        >> the same basic layout (centered top graphic, for example), that a page
        >> with a <script> block in the <head> shifts the HTML contents some number
        >> of pixels to the right.
        >>
        >> Other than putting a blank <script> block into each web page, or putting
        >> SCRIPT at the bottom of the BODY, any other way to work around this?
        >>
        >> Thanks[/color]
        >
        > Post an example or link to one. It's really a CSS question, but I'm
        > happy to play along...[/color]

        Here's the HTML. If the <script> block is un-commented, the body (with
        an image) shifts to the right. As it turns out, this appears to be a
        result of using "leftmargin ", which still resides in HTML templates I
        wrote years ago before I used CSS. And which I will modify as needed!


        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

        <html>
        <head>
        <title>Why Does a Script Block Alter Layout?</title>

        <!--
        <script>
        </script>
        -->

        </head>
        <body leftmargin="0" topmargin="0">
        <div align=center>
        <img src=yourimage.g if>
        <br>
        <h1>Where am now?</h1>
        </div>
        </body>
        </html>

        Comment

        • RobG

          #5
          Re: Javascript block alters layout in IE

          Steve wrote:[color=blue]
          > RobG <rgqld@iinet.ne t.auau> wrote:
          >
          >[color=green]
          >>Steve wrote:
          >>[color=darkred]
          >>>I just noticed, in IE6, when navagating from one page to another with
          >>>the same basic layout (centered top graphic, for example), that a page
          >>>with a <script> block in the <head> shifts the HTML contents some number
          >>>of pixels to the right.
          >>>
          >>>Other than putting a blank <script> block into each web page, or putting
          >>>SCRIPT at the bottom of the BODY, any other way to work around this?
          >>>
          >>>Thanks[/color]
          >>
          >> Post an example or link to one. It's really a CSS question, but I'm
          >> happy to play along...[/color]
          >
          >
          > Here's the HTML. If the <script> block is un-commented, the body (with
          > an image) shifts to the right. As it turns out, this appears to be a
          > result of using "leftmargin ", which still resides in HTML templates I
          > wrote years ago before I used CSS. And which I will modify as needed!
          >[/color]

          I couldn't see any shift at all. I can only suggest that you move to
          HTML 4 strict to keep IE (and other browsers) from changing to quirks
          mode and replace depreciated attributes (such as the align attribute of
          div elements) with CSS.

          In any case, you will probably get a better explanation at either:

          comp.infosystem s.www.authoring.stylesheets

          or

          comp.infosystem s.www.authoring.html



          --
          Rob

          Comment

          • Thomas 'PointedEars' Lahn

            #6
            Re: Javascript block alters layout in IE

            Steve wrote:
            [color=blue]
            > [...] If the <script> block is un-commented, the body (with
            > an image) shifts to the right. As it turns out, this appears to be a
            > result of using "leftmargin ", which still resides in HTML templates I
            > wrote years ago before I used CSS. And which I will modify as needed!
            >
            >
            > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
            >
            > <html>
            > <head>
            > <title>Why Does a Script Block Alter Layout?</title>
            >
            > <!--
            > <script>
            > </script>
            > -->[/color]

            That `script' element, if uncommented, is located within the `head' element,
            so it should not have any impact on the layout. However, you are declaring
            a deprecated DOCTYPE without system identifier and the `script' element
            lacks the `type' attribute which is required since HTML 4.0; this may have
            triggered Compatibility Mode which in turn could alter layout.

            But it could also be caused by a caching error.
            [color=blue]
            > [...][/color]

            BTW: As your sender address is forged, this will be my last reply to a
            posting of you until further, appropriate changes by you.


            PointedEars

            Comment

            Working...