I have been trying to set the table row height on a webpage using JavaScript. At first I tried to use the JavaScript DOM but didn't realise it doesn't cover tables. I have a JavaScript function which returns the available window size and would like to set the table row based on this value, but just don't seem to be able to get it to work.
Here is the function I am using which returns the tableHeight:
function tableHeight() {
var myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else {
if( document.documentElement &&
( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else {
if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myHeight = document.body.clientHeight;
}
}
}
return myHeight;
}
I have tried as many different ways of setting the height using the function as I can think of including...
<TABLE WIDTH="100%" BORDER="1" CELLPADDING="0" CELLSPACING="0">
<TR HEIGHT=javascript:tableHeight();>
<TD>
</TD>
</TR>
</TABLE>
can anyone suggest where I am going wrong!!!!
Here is the function I am using which returns the tableHeight:
function tableHeight() {
var myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else {
if( document.documentElement &&
( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else {
if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myHeight = document.body.clientHeight;
}
}
}
return myHeight;
}
I have tried as many different ways of setting the height using the function as I can think of including...
<TABLE WIDTH="100%" BORDER="1" CELLPADDING="0" CELLSPACING="0">
<TR HEIGHT=javascript:tableHeight();>
<TD>
</TD>
</TR>
</TABLE>
can anyone suggest where I am going wrong!!!!