R
reynard
I have a page that uses this doctype
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
but when I change to this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
it breaks my javascript. Particularly I have a code that try to set
element.style.left, when I use the second doctype, FF complains "Error
in parsing value for property 'left'. Declaration dropped"
I turns out that I was setting it to just integer number before, and
when I use the second doctype you have to set it with the unit as well.
So instead of:
element.style.left = 25;
you have to do:
element.style.left = '25px';
I thought it really was a weird behavior. Is there any other case where
changing the doctype changes js behavior?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
but when I change to this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
it breaks my javascript. Particularly I have a code that try to set
element.style.left, when I use the second doctype, FF complains "Error
in parsing value for property 'left'. Declaration dropped"
I turns out that I was setting it to just integer number before, and
when I use the second doctype you have to set it with the unit as well.
So instead of:
element.style.left = 25;
you have to do:
element.style.left = '25px';
I thought it really was a weird behavior. Is there any other case where
changing the doctype changes js behavior?