PDA

View Full Version : Problem with table-height in Netscape 4.x


Michiel
09-21-2002, 04:58 PM
Hi,

I've just finished my website and now I've discovered a problem that occurs when the site is viewed in Netscape 4.x Please take a look at the specific page (url: http://www.mileswebdesign.nl/site.php?x=5). As you can see two big black borders appear at the top and the bottom because the content is not long enough. When I view the page in IE it all looks fine. Does anyone know a 'cross-browser' solution??

Thanx Michiel

Spookster
09-21-2002, 07:09 PM
I couldn't even open your site in NS4.x. It kept redirecting to your style sheet.

NS4.x doesn't particularly like having a table height set using percentages so here is a workaround:



<html>
<head>
<title>Full Height Table</title>
</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
<script lanaguage="Javascript">
<!--//
var IE5up = document.getElementById&&document.all;
var NS6up = document.getElementById&&!document.all;
var NS4 = document.layers;
var IE4 = document.all&&!window.print;
if(NS4||NS6up)
h=window.innerHeight;
else
h=document.body.clientHeight;

//THIS IS THE START OF YOUR TABLE
document.write('<table bgcolor="orange" border="1" width="100%" height="'+h+'">');

document.close();
//-->
</script>
<noscript>
<!-- THIS IS FOR NONJAVASCRIPT ENABLED BROWSERS -->
<table border="1" height="100%">
</noscript>

<tr><td>
<h1>Some Text</h1>
</td></tr>
</table>
</body>

</html>

Michiel
09-21-2002, 07:31 PM
Thanks for your solution, I'll go and add that to my page!

Do you know why NS4.x redirected you to the stylesheet? I simply used this line:

<link rel="stylesheet" type="text/css" href="style/NS1024x768.css">

This is written by a javascript depending on the browser and screenresolution. Do you know a way to make this work after all?

Thanx Michiel