P
PeteM
I've got a problem that is driving me mad.
I have two pages a search page and display page. The search page has a
number of links something like
"window.opener.parent.location('display.aspx?id=xxx')" this works fine.
The display page has an iframe (called ifForm) that I want resized to
make the best use of available real estate, the code I am using is:
-------------------------------------
function resizeStuff()
{
var theFrame = document.getElementById("ifForm");
var height = 0;
if (window.innerHeight) {height = window.innerHeight - 18;}
else if (document.documentElement &&
document.documentElement.clientHeight)
{ height = document.documentElement.clientHeight;}
else if (document.body && document.body.clientHeight)
{height = document.body.clientHeight;}
var width = 0;
if (window.innerWidth) {width = window.innerWidth - 18;}
else if (document.documentElement &&
document.documentElement.clientWidth)
{width = document.documentElement.clientWidth;}
else if (document.body && document.body.clientWidth)
{width = document.body.clientWidth;}
theFrame.style.height = (height -
theFrame.style.top.substr(0,theFrame.style.top.length-2) - 20)+ "px";
theFrame.style.width = (width -
theFrame.style.left.substr(0,theFrame.style.left.length-2) - 20)+ "px";
}
------------------------------------------------------
The code is attached to the resize and load events. When you open the
page directly this work perfectly, when you press a link from the
search page on the first time it works perfectly but on the second time
it fails because document.documentElement.clientHeight returns zero. I
don't see why this code should work correctly most of the time but fail
in a repeatable way on the second call from another page.
Anyone got any ideas?
Pete
I have two pages a search page and display page. The search page has a
number of links something like
"window.opener.parent.location('display.aspx?id=xxx')" this works fine.
The display page has an iframe (called ifForm) that I want resized to
make the best use of available real estate, the code I am using is:
-------------------------------------
function resizeStuff()
{
var theFrame = document.getElementById("ifForm");
var height = 0;
if (window.innerHeight) {height = window.innerHeight - 18;}
else if (document.documentElement &&
document.documentElement.clientHeight)
{ height = document.documentElement.clientHeight;}
else if (document.body && document.body.clientHeight)
{height = document.body.clientHeight;}
var width = 0;
if (window.innerWidth) {width = window.innerWidth - 18;}
else if (document.documentElement &&
document.documentElement.clientWidth)
{width = document.documentElement.clientWidth;}
else if (document.body && document.body.clientWidth)
{width = document.body.clientWidth;}
theFrame.style.height = (height -
theFrame.style.top.substr(0,theFrame.style.top.length-2) - 20)+ "px";
theFrame.style.width = (width -
theFrame.style.left.substr(0,theFrame.style.left.length-2) - 20)+ "px";
}
------------------------------------------------------
The code is attached to the resize and load events. When you open the
page directly this work perfectly, when you press a link from the
search page on the first time it works perfectly but on the second time
it fails because document.documentElement.clientHeight returns zero. I
don't see why this code should work correctly most of the time but fail
in a repeatable way on the second call from another page.
Anyone got any ideas?
Pete