Hi,
I am trying to use javascript to specify the height of a page element on page load. The following seems to work in IE but not in FF or NS.
I appreciate that I am likely to have to detect the browser type and window size for the design I have been given, but I need to set some element heights for different resolutions.
Any comments or suggestions appreciated.
I am trying to use javascript to specify the height of a page element on page load. The following seems to work in IE but not in FF or NS.
I appreciate that I am likely to have to detect the browser type and window size for the design I have been given, but I need to set some element heights for different resolutions.
Any comments or suggestions appreciated.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/strict.dtd">[/URL]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style>
#main {background-color:#00CC00; width:100%; }
</style>
<script language="javascript" type="text/javascript">
<!--
function testsize()
{
var varTopContWidth = document.getElementById("main").offsetHeight;
main.style.height = '55px';
}
-->
</script>
</head>
<body onLoad="testsize()">
<div id="main">
main
</div>
</body>
</html>