Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > javascript and strict doctype

Reply
Thread Tools

javascript and strict doctype

 
 
Jeff
Guest
Posts: n/a
 
      01-26-2008
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
 
Reply With Quote
 
 
 
 
aoksite1@gmail.com
Guest
Posts: n/a
 
      01-26-2008
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
 
Reply With Quote
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      01-26-2008
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
 
Reply With Quote
 
Stanimir Stamenkov
Guest
Posts: n/a
 
      01-27-2008
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
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      01-27-2008
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
 
Reply With Quote
 
aoksite1@gmail.com
Guest
Posts: n/a
 
      01-27-2008
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
 
Reply With Quote
 
Jeff
Guest
Posts: n/a
 
      01-27-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) 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

 
Reply With Quote
 
A-OK-SITE
Guest
Posts: n/a
 
      01-27-2008
On Jan 26, 10:54 pm, Jeff <jeff@spam_me_not.com> wrote:
> (E-Mail Removed) 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
 
Reply With Quote
 
Jeff
Guest
Posts: n/a
 
      01-27-2008
A-OK-SITE wrote:
> On Jan 26, 10:54 pm, Jeff <jeff@spam_me_not.com> wrote:
>> (E-Mail Removed) 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

 
Reply With Quote
 
A-OK-SITE
Guest
Posts: n/a
 
      01-27-2008
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:
> >> (E-Mail Removed) 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS Newbie - CSS Works With Invalid DOCTYPE. Fails With Valid DOCTYPE. Larry Lindstrom HTML 19 06-12-2012 02:07 PM
Struts and XHTML strict doctype John Java 1 01-13-2008 11:51 PM
DOCTYPE Strict uses "correct" box model - so why is 100% width now useless? Shadow Lynx ASP .Net 1 03-11-2006 10:26 PM
Doctype strict and IE6 - monitoring scrolling Tony T Javascript 2 03-02-2004 06:07 PM
Form target attribute--not validating with strict doctype? TheKeith HTML 9 10-21-2003 11:06 PM



Advertisments