Forum Moderators: open

Message Too Old, No Replies

forward a calculated value to table attribute height

         

kristof_v

6:14 pm on Sep 20, 2005 (gmt 0)

10+ Year Member



lo,

i've created the following simple javascript functio to calculate the clients screen height:
function getHeight() {
y = window.screen.availHeight;
res = y+"px";
//alert(res);
return res;
}

how can i pass this value to the table height attribute so that the table fills the entire screen vertically under every resolution

any help is much appreciated!

grtz kristof

Eltiti

6:49 pm on Sep 20, 2005 (gmt 0)

10+ Year Member



What's wrong with <table height="100%">?

kristof_v

6:51 pm on Sep 20, 2005 (gmt 0)

10+ Year Member



i've tried that but it didn't work :s

Eltiti

6:55 pm on Sep 20, 2005 (gmt 0)

10+ Year Member



OK, I see (I quickly tried it before I posted my answer, and it worked for me)...

In that case, use JS to create the table as well:

document.write('<table height="' + getHeight() + '"...>');

kristof_v

7:04 pm on Sep 20, 2005 (gmt 0)

10+ Year Member



ok thats a good idea.
it took me somewhat further but now i have another problem.
it is not exactly as i hoped, it is centered but the outer table is now bigger than the vertical screen resolution :s

[edited by: jatar_k at 7:29 pm (utc) on Sep. 20, 2005]
[edit reason] no urls thanks [/edit]

Eltiti

7:15 pm on Sep 20, 2005 (gmt 0)

10+ Year Member



Well, you need to make sure that the "inner" content uses all the available space --so you need to specify 'height="100%"' there as well!

(BTW, URL drops are not allowed in this forum; a moderator will probably remove it from your post.)

Good luck with the site!

birdbrain

7:18 pm on Sep 20, 2005 (gmt 0)



Hi there kristof_v,

try this, it may give you some ideas...


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224">
<html>
<head>
<title>full size table</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
<!--
function getHeight() {
document.getElementById('tbl').style.height=document.body.offsetHeight+'px';
document.getElementById('tbl').style.width='700px';
}
//-->
</script>
<style type="text/css">
<!--
html,body {
height:100%;
margin:0px;
padding:0px;
}
#tbl {
border:2px solid #f66;
margin:auto;
}
#tbl td {
border:1px solid #933;
text-align:center;
}
-->
</style>
</head>
<body>
<table id="tbl"><tr>
<td onclick="getHeight()">click here</td>
</tr></table>
</body>
</html>

birdbrain

kristof_v

7:40 pm on Sep 20, 2005 (gmt 0)

10+ Year Member



thx a lot birdbrain!
thats exactly what i need

thx for the quick and helpful replies, i appreciate that (y)

birdbrain

7:56 pm on Sep 20, 2005 (gmt 0)



No problem, you're welcome. ;)