[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 02-04-2006, 03:03 AM   #1 (permalink)
NamePros Member
 
Join Date: Aug 2005
Posts: 29
44.00 NP$ (Donate)

kareltje is an unknown quantity at this point


Question javascript table resize won't work in firefox

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?
kareltje is offline  
Old 02-04-2006, 05:54 AM   #2 (permalink)
NamePros Regular
 
Rowan W's Avatar
 
Join Date: Dec 2004
Location: QLD, Australia
Posts: 713
1,869.00 NP$ (Donate)

Rowan W will become famous soon enough


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>
Rowan W is offline  
Old 02-04-2006, 06:53 AM   #3 (permalink)
NamePros Member
 
Join Date: Aug 2005
Posts: 29
44.00 NP$ (Donate)

kareltje is an unknown quantity at this point


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 by kareltje; 02-04-2006 at 06:59 AM.
kareltje is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
My footer won't reach the bottom of the page in Firefox!! will7 Programming 3 04-26-2005 10:21 PM
Portable Firefox Dave in Carthage Free Resources 2 04-03-2005 10:34 AM
Wierd FireFox problem! HELP! ChrisK76 Web Design Discussion 8 03-24-2005 06:32 AM
Willing to do work for cheap (just got scammed) iDeviseFlash For Sale / Advertising Board 5 11-07-2004 12:09 AM

Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 05:39 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85