For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > February 2007 > unnecessary white space at bottom for netscape









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author unnecessary white space at bottom for netscape
Victor

2007-02-27, 10:13 pm

Hi I have a very strange problem for my page. I have writen a js to make
sure my table's height is 100% for the browser's viewport. my code is just
the following. This works fine for firefox and IE. but in netscape, i found
there is some white space at the bottom of the page whose height is about
10- 20 pixal. and these white space cause the v-scrollbar appears. I have no
idea what is wrong here. Can any one help me on this one.

Cheers
Victor

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body style="padding:0;margin:0; ">
<form id="form1" runat="server">
<script type="text/javascript">
function getWindowHeight()
{
var windowHeight=0;
var minWindowHeight = 700;
if (typeof(window.innerHeight)=='number')
{
windowHeight = window.innerHeight;
}
else
{
if (document.documentElement&&
document.documentElement.clientHeight)
{
windowHeight = document.documentElement.clientHeight;
}
else
{
if (document.body&&document.body.clientHeight)
{
windowHeight = document.body.clientHeight;
}
}
}

if (windowHeight < minWindowHeight)
windowHeight = minWindowHeight;

return windowHeight;
}

function setHeight()
{
if (document.getElementById)
{
var windowHeight=getWindowHeight();

if (windowHeight > 0)
{
var tblMain = document.getElementById("tblMain");
tblMain.style.height = windowHeight + 'px';
}
}
}

window.onload = function() {setHeight();}
window.onresize = function() {setHeight();}

</script>
<table id="tblMain" cellpadding="0" cellspacing="0" width="980px"
style="border:solid 1px red;">
<tr>
<td>
testing info
</td>
</tr>
</table>
</form>
</body>
</html>


Alexey Smirnov

2007-02-28, 4:13 am

On Feb 28, 3:30 am, "Victor" <vic...@noemail.noemail> wrote:
> Hi I have a very strange problem for my page. I have writen a js to make
> sure my table's height is 100% for the browser's viewport. my code is just
> the following. This works fine for firefox and IE. but in netscape, i found
> there is some white space at the bottom of the page whose height is about
> 10- 20 pixal. and these white space cause the v-scrollbar appears. I have no
> idea what is wrong here. Can any one help me on this one.
>
> Cheers
> Victor
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
> <html xmlns="http://www.w3.org/1999/xhtml" >
> <head runat="server">
> <title>Untitled Page</title>
> </head>
> <body style="padding:0;margin:0; ">
> <form id="form1" runat="server">
> <script type="text/javascript">
> function getWindowHeight()
> {
> var windowHeight=0;
> var minWindowHeight = 700;
> if (typeof(window.innerHeight)=='number')
> {
> windowHeight = window.innerHeight;
> }
> else
> {
> if (document.documentElement&&
> document.documentElement.clientHeight)
> {
> windowHeight = document.documentElement.clientHeight;
> }
> else
> {
> if (document.body&&document.body.clientHeight)
> {
> windowHeight = document.body.clientHeight;
> }
> }
> }
>
> if (windowHeight < minWindowHeight)
> windowHeight = minWindowHeight;
>
> return windowHeight;
> }
>
> function setHeight()
> {
> if (document.getElementById)
> {
> var windowHeight=getWindowHeight();
>
> if (windowHeight > 0)
> {
> var tblMain = document.getElementById("tblMain");
> tblMain.style.height = windowHeight + 'px';
> }
> }
> }
>
> window.onload = function() {setHeight();}
> window.onresize = function() {setHeight();}
>
> </script>
> <table id="tblMain" cellpadding="0" cellspacing="0" width="980px"
> style="border:solid 1px red;">
> <tr>
> <td>
> testing info
> </td>
> </tr>
> </table>
> </form>
> </body>
> </html>


here's nothing related to ASP.NET

Netscape's window.innerWidth and window.innerHeight properties always
included the width/height of scrollbars
http://www.jibbering.com/2002/7/drunclear-measure.html

Steven Cheng[MSFT]

2007-02-28, 4:13 am

Hello Victor,

Regarding on the problem page, have you tried compare the client-side
rendered html source to see whether there is any different between the
netscape and other browsers? If not, I'm afraid the problem is likely due
to the netscape's particular rendering engine. Also, you can try manually
set all the margin(four margin css style attrributes) to see whether it
helps.

<body style="margin-bottom:0; margin-left:0; margin-right:0; margin-top:0">

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com