Connecting Tech Pros Worldwide Help | Site Map

Match Length with CSS and JavaScript

thom@tlanet.net
Guest
 
Posts: n/a
#1: Sep 21 '07
Two samples are provided for this isse ...

tlanet.net/1.html - attempt to match heights with CSS
tlanet.net/2.html - match height with CSS and JavaScript

The second example correctly calulates the size of a Div to match another
Div that varies from page to page.

This solution works in Internet Explorer and Opera but not Firefox and
Netscape.

Can you tell me why?

Thanks.,

.... Thom
Joshua Cranmer
Guest
 
Posts: n/a
#2: Sep 22 '07

re: Match Length with CSS and JavaScript


thom@tlanet.net wrote:
Quote:
Two samples are provided for this isse ...
>
tlanet.net/1.html - attempt to match heights with CSS
tlanet.net/2.html - match height with CSS and JavaScript
>
The second example correctly calulates the size of a Div to match another
Div that varies from page to page.
>
This solution works in Internet Explorer and Opera but not Firefox and
Netscape.
>
Can you tell me why?
>
Thanks.,
>
... Thom
Testing your JavaScript revealed that you are setting {element}.height =
128, which is incorrect JavaScript.

Try changing it to {element}.height = {value}+"px" and see how that line
of code works.

It also appears that the height you end up setting to the element via
JavaScript is not what you want it to be...

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
thom@tlanet.net
Guest
 
Posts: n/a
#3: Sep 22 '07

re: Match Length with CSS and JavaScript


Yes ... I discovered that in parallel to your reply ...

IE and Opera accept it with or without the "px"
Firefox and Netscape require that the "px" be present.

Thank you for the help.

.... Thom
Closed Thread