I played around with this idea a bit more and came up with this script for the head of your iframe page:
Code:
<script type="text/javascript">
function resize(name,pcnt,wdth,hgt){
opr6=document.all&&navigator.userAgent.indexOf("Opera")!=-1
if (document.all&&!opr6){
var shobj=document.all[name].style
shobj.zoom=pcnt+'%'
shobj.width=Math.floor(wdth/(pcnt/100))+'px'
shobj.height=Math.floor(hgt/(pcnt/100))+'px'
}
}
</script>
Now things are much simpler when it comes to resizing, you can use the declared width and height of the iframe. Say the iframe's name is mainFrame and the width is 350, height is 525. Do this:
HTML Code:
<a href="toobig.htm" target="mainFrame"
onClick="resize('mainFrame',75,350,525)">Click for small version of toobig.htm</a>
This will shrink the page to 75% of its original size while adjusting the iframe's size to compensate. And instead of using restorative code on the links for the other pages, you can put this onload event in their body tags:
HTML Code:
<body onload="if(window.parent.resize){window.parent.resize('mainFrame',100,350,525)}">
That way, even if a someone uses their back button, the iframe will still be restored.
Bookmarks