javascript and strict doctype

J

Jeff

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
 
A

aoksite1

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
 
J

Jonathan N. Little

Jeff said:
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.
 
S

Stanimir Stamenkov

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";
 
T

Thomas 'PointedEars' Lahn

Stanimir said:
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
 
A

aoksite1

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
 
J

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top