javascript and strict doctype

Discussion in 'HTML' started by Jeff, Jan 26, 2008.

  1. Jeff

    Jeff Guest

    I have a page with a bit of DHTML that I wrote years ago that I'm
    updating.

    This works as expected without a doctype, but when I add a html 4.01
    doctype, strange things happen.

    IE has trouble redrawing the page background color (I'm adding a rule
    for that), it's funky and sometimes it leaves a bit of the previous
    color. In Fire Fox, reading element positions is way wrong (I get 0 0
    on somethings).

    The page passes W3C validation.

    What gives?

    Jeff
     
    Jeff, Jan 26, 2008
    #1
    1. Advertising

  2. Jeff

    Guest

    On Jan 26, 3:20 pm, Jeff <jeff@spam_me_not.com> wrote:
    > I have a page with a bit of DHTML that I wrote years ago that I'm
    > updating.
    >
    > This works as expected without a doctype, but when I add a html 4.01
    > doctype, strange things happen.
    >
    > IE has trouble redrawing the page background color (I'm adding a rule
    > for that), it's funky and sometimes it leaves a bit of the previous
    > color. In Fire Fox, reading element positions is way wrong (I get 0 0
    > on somethings).
    >
    > The page passes W3C validation.
    >
    > What gives?
    >
    > Jeff


    Jeff,

    If you leave the URL, it would help.

    Daniel

    http://a-ok-site.com
     
    , Jan 26, 2008
    #2
    1. Advertising

  3. Jeff wrote:
    > I have a page with a bit of DHTML that I wrote years ago that I'm
    > updating.
    >
    > This works as expected without a doctype, but when I add a html 4.01
    > doctype, strange things happen.
    >
    > IE has trouble redrawing the page background color (I'm adding a rule
    > for that), it's funky and sometimes it leaves a bit of the previous
    > color. In Fire Fox, reading element positions is way wrong (I get 0 0
    > on somethings).
    >
    > The page passes W3C validation.
    >
    > What gives?
    >


    It sometimes happens with code found on line 6.


    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Jan 26, 2008
    #3
  4. Sat, 26 Jan 2008 16:20:11 -0500, /Jeff/:

    > This works as expected without a doctype, but when I add a html 4.01
    > doctype, strange things happen.
    >
    > IE has trouble redrawing the page background color (I'm adding a rule
    > for that), it's funky and sometimes it leaves a bit of the previous
    > color. In Fire Fox, reading element positions is way wrong (I get 0 0
    > on somethings).


    "http://websiterepairguru.com/colorpicker_2.htm", line 275:

    target_menu.style.left=(pos.x);
    target_menu.style.top=pos.y + pos.height;

    You don't specify units:

    target_menu.style.left=(pos.x) + "px";
    target_menu.style.top=(pos.y + pos.height) + "px";

    --
    Stanimir
     
    Stanimir Stamenkov, Jan 27, 2008
    #4
  5. Stanimir Stamenkov wrote:
    > target_menu.style.left=(pos.x) + "px";


    The parentheses are unnecessary.

    > target_menu.style.top=(pos.y + pos.height) + "px";


    This will most likely not work, because with this getPosition() method
    pos.height would yield the value of the `height' property which would most
    likely include a unit of length (the unit is not required only if the length
    is 0). So for example the above could be evaluated to

    target_menu.style.top = (42 + "23px") + "px";

    and therefore

    target_menu.style.top = "4223px" + "px";

    and eventually

    target_menu.style.top = "4223pxpx";

    which would be an invalid property value.

    It would work if pos.height would be the value of the `offsetHeight'
    property of the element object instead. Same for pos.width and `offsetWidth'.


    F'up2 comp.lang.javascript

    PointedEars
    --
    var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
    ) // Plone, register_function.js:16
     
    Thomas 'PointedEars' Lahn, Jan 27, 2008
    #5
  6. Jeff

    Guest

    On Jan 26, 3:20 pm, Jeff <jeff@spam_me_not.com> wrote:
    > I have a page with a bit of DHTML that I wrote years ago that I'm
    > updating.
    >
    > This works as expected without a doctype, but when I add a html 4.01
    > doctype, strange things happen.
    >
    > IE has trouble redrawing the page background color (I'm adding a rule
    > for that), it's funky and sometimes it leaves a bit of the previous
    > color. In Fire Fox, reading element positions is way wrong (I get 0 0
    > on somethings).
    >
    > The page passes W3C validation.
    >
    > What gives?
    >
    > Jeff


    Jeff,

    I think this may be what you wanted. Not sure but works a little
    better. Let me know something.

    http://a-ok-site.com/tmp/test.htm

    Daniel

    http://a-ok-site.com
     
    , Jan 27, 2008
    #6
  7. Jeff

    Jeff Guest

    wrote:
    > On Jan 26, 3:20 pm, Jeff <jeff@spam_me_not.com> wrote:
    >> I have a page with a bit of DHTML that I wrote years ago that I'm
    >> updating.
    >>
    >> This works as expected without a doctype, but when I add a html 4.01
    >> doctype, strange things happen.
    >>
    >> IE has trouble redrawing the page background color (I'm adding a rule
    >> for that), it's funky and sometimes it leaves a bit of the previous
    >> color. In Fire Fox, reading element positions is way wrong (I get 0 0
    >> on somethings).
    >>
    >> The page passes W3C validation.
    >>
    >> What gives?
    >>
    >> Jeff

    >
    > Jeff,
    >
    > I think this may be what you wanted. Not sure but works a little
    > better. Let me know something.
    >
    > http://a-ok-site.com/tmp/test.htm


    I was going to say "genius"! That you had gotten rid of the IE
    problem with strict. But then I noticed you changed the doctype to
    transitional!

    Thanks for your time, I know you spent a bit.

    Jeff
    >
    > Daniel
    >
    > http://a-ok-site.com
     
    Jeff, Jan 27, 2008
    #7
  8. Jeff

    A-OK-SITE Guest

    On Jan 26, 10:54 pm, Jeff <jeff@spam_me_not.com> wrote:
    > wrote:
    > > On Jan 26, 3:20 pm, Jeff <jeff@spam_me_not.com> wrote:
    > >> I have a page with a bit of DHTML that I wrote years ago that I'm
    > >> updating.

    >
    > >> This works as expected without a doctype, but when I add a html 4.01
    > >> doctype, strange things happen.

    >
    > >> IE has trouble redrawing the page background color (I'm adding a rule
    > >> for that), it's funky and sometimes it leaves a bit of the previous
    > >> color. In Fire Fox, reading element positions is way wrong (I get 0 0
    > >> on somethings).

    >
    > >> The page passes W3C validation.

    >
    > >> What gives?

    >
    > >> Jeff

    >
    > > Jeff,

    >
    > > I think this may be what you wanted. Not sure but works a little
    > > better. Let me know something.

    >
    > >http://a-ok-site.com/tmp/test.htm

    >
    > I was going to say "genius"! That you had gotten rid of the IE
    > problem with strict. But then I noticed you changed the doctype to
    > transitional!
    >
    > Thanks for your time, I know you spent a bit.
    >
    > Jeff
    >
    >
    >
    > > Daniel

    >
    > >http://a-ok-site.com


    I changed it to strict. Sorry didn't think it was important. The IE
    is still fixed.

    http://a-ok-site.com/tmp/test.htm

    Daniel

    http://a-ok-site.com
     
    A-OK-SITE, Jan 27, 2008
    #8
  9. Jeff

    Jeff Guest

    A-OK-SITE wrote:
    > On Jan 26, 10:54 pm, Jeff <jeff@spam_me_not.com> wrote:
    >> wrote:
    >>> On Jan 26, 3:20 pm, Jeff <jeff@spam_me_not.com> wrote:
    >>>> I have a page with a bit of DHTML that I wrote years ago that I'm
    >>>> updating.
    >>>> This works as expected without a doctype, but when I add a html 4.01
    >>>> doctype, strange things happen.
    >>>> IE has trouble redrawing the page background color (I'm adding a rule
    >>>> for that), it's funky and sometimes it leaves a bit of the previous
    >>>> color. In Fire Fox, reading element positions is way wrong (I get 0 0
    >>>> on somethings).
    >>>> The page passes W3C validation.
    >>>> What gives?
    >>>> Jeff
    >>> Jeff,
    >>> I think this may be what you wanted. Not sure but works a little
    >>> better. Let me know something.
    >>> http://a-ok-site.com/tmp/test.htm

    >> I was going to say "genius"! That you had gotten rid of the IE
    >> problem with strict. But then I noticed you changed the doctype to
    >> transitional!
    >>
    >> Thanks for your time, I know you spent a bit.
    >>
    >> Jeff
    >>
    >>
    >>
    >>> Daniel
    >>> http://a-ok-site.com


    Hello Daniel,
    >
    > I changed it to strict. Sorry didn't think it was important. The IE
    > is still fixed.
    >
    > http://a-ok-site.com/tmp/test.htm


    Well, I'll give you that. Thanks!

    Now, I notice you did several things. What do you think "fixed" it?

    Jeff
    >
    > Daniel
    >
    > http://a-ok-site.com
     
    Jeff, Jan 27, 2008
    #9
  10. Jeff

    A-OK-SITE Guest

    On Jan 27, 9:14 am, Jeff <jeff@spam_me_not.com> wrote:
    > A-OK-SITE wrote:
    > > On Jan 26, 10:54 pm, Jeff <jeff@spam_me_not.com> wrote:
    > >> wrote:
    > >>> On Jan 26, 3:20 pm, Jeff <jeff@spam_me_not.com> wrote:
    > >>>> I have a page with a bit of DHTML that I wrote years ago that I'm
    > >>>> updating.
    > >>>> This works as expected without a doctype, but when I add a html 4.01
    > >>>> doctype, strange things happen.
    > >>>> IE has trouble redrawing the page background color (I'm adding a rule
    > >>>> for that), it's funky and sometimes it leaves a bit of the previous
    > >>>> color. In Fire Fox, reading element positions is way wrong (I get 0 0
    > >>>> on somethings).
    > >>>> The page passes W3C validation.
    > >>>> What gives?
    > >>>> Jeff
    > >>> Jeff,
    > >>> I think this may be what you wanted. Not sure but works a little
    > >>> better. Let me know something.
    > >>>http://a-ok-site.com/tmp/test.htm
    > >> I was going to say "genius"! That you had gotten rid of the IE
    > >> problem with strict. But then I noticed you changed the doctype to
    > >> transitional!

    >
    > >> Thanks for your time, I know you spent a bit.

    >
    > >> Jeff

    >
    > >>> Daniel
    > >>>http://a-ok-site.com

    >
    > Hello Daniel,
    >
    >
    >
    > > I changed it to strict. Sorry didn't think it was important. The IE
    > > is still fixed.

    >
    > >http://a-ok-site.com/tmp/test.htm

    >
    > Well, I'll give you that. Thanks!
    >
    > Now, I notice you did several things. What do you think "fixed" it?
    >
    > Jeff
    >
    >
    >
    > > Daniel

    >
    > >http://a-ok-site.com


    Standard layout. Box model.

    Daniel

    http://a-ok-site.com
     
    A-OK-SITE, Jan 27, 2008
    #10
    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.
Similar Threads
  1. Shadow Lynx
    Replies:
    1
    Views:
    561
    Shadow Lynx
    Mar 11, 2006
  2. TheKeith
    Replies:
    9
    Views:
    1,178
    Leif K-Brooks
    Oct 22, 2003
  3. John
    Replies:
    1
    Views:
    610
  4. Tony T
    Replies:
    2
    Views:
    149
    Tony T
    Mar 2, 2004
  5. Larry Lindstrom
    Replies:
    19
    Views:
    1,335
    Jonathan N. Little
    Jun 12, 2012
Loading...

Share This Page