Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting style.height to div through js works in IE but not FF

Status
Not open for further replies.

bopritchard

Programmer
Jan 27, 2003
199
US
here's my page

in the onload i'm running a setheight() javascript function that looks at the height of a couple of other divs and then sets the height of another div...

it works fine in IE but does nothing in firefox...anyone know why?

thanks
 
This works for me in FF:
Code:
alert(document.body.clientWidth);
I'm guessing you will want clientHeight as well [smile]

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
so how would write this using that method

document.getElementById('calendarcontent').style.height=200px;
 
Like this...
Code:
document.getElementById('calendarcontent').style.height='200px';

When you set it, remember that it is a string, and so needs to be wrapped in quotes or whatever :)

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
ensure that you add the dimension specifier (eg: px) to the value.

IE (as usual) will ignore the missing dimension specifier and assume pixels, FF correctly requires it.

Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top