Hi,
This is a demo of what I'm trying to do:
<html>
<head>
<script type="text/javascript">
window.onresize = resize;
function resize()
{
if (document.getElementById('elm1').offsetWidth < 1000)
{
document.getElementById('elm2').style.width = 1000
}
if (document.getElementById('elm1').offsetHeight < 600)
{
document.getElementById('elm2').style.height = 600
}
if (document.getElementById('elm1').offsetWidth > 1000)
{
document.getElementById('elm2').style.width = "100%"
}
if (document.getElementById('elm1').offsetHeight > 600 )
{
document.getElementById('elm2').style.height = "100%"
}
}
</script>
<style type="text/css">
#elm2
{
width: 100%;
height: 100%;
background: red
}
</style>
</head>
<body id="elm1">
<div id="elm2"></div>
</body>
</html>
It works perfectly with all browsers except Firefox.
In Firefox, when this part of the code is executed:
if (document.getElementById('elm1').offsetHeight < 600)
{
document.getElementById('elm2').style.height = 600
}
it sets the value to elm2 and elm1...
Firefox version: 7.0.1
Is there a way to go around this?
Thanks,
GG3L