Unstoppable Domains

Javascript table resize won't work in firefox

Spaceship Spaceship
Watch

kareltje

Established Member
Impact
0
I'm trying to make a table fit into a window, it works well in IE, but doesn't work at all in Firefox. Here's my code:

function adjustHeight() {
var contsheight = document.documentElement.clientHeight;
conts.height=contsheight // conts is the table ID
}

and in the body tag:

<body background="../bggradient.jpg" onload="javascript:adjustHeight();" onresize="javascript:adjustHeight();">

my table's tag looks like this:

<table width="100%" border="0" cellpadding="0" cellspacing="0" ID="conts"">

IE does the job just fine, while Firefox doesn't do a thing. Debugging has taught me that firefox does know the "document.documentElement.clientHeight"-variable, and Firefox' Javascript Console says: "conts is not declared". I've also tried the getObjectByID function but that didn't help either.
It's not my first compatibility issue, but this time I don't know what to do with it. Anyone else know how to deal with this problem?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Have you tried "height:100%" in CSS?

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<html>
<head>
<title>One Hundred Percent Height</title>
<style type="text/css">
html {
  height: 100%;
}
body {
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: #fff;
}
table {
  height: 100%;
  background-color: #69c;
}
</style>
</head>
<body>

<table>
  <tr>
    <td>table cell</td>
  </tr>
</table>

</body>
</html>
</head>
 
0
•••
thanks a lot, when i first tried it it didn't work but then I realised that I had to apply it to the onclosing DIV as well. now everything is working well.
 
Last edited:
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back