I have an iframe that loads a page inside it.. when a link is clicked on the page in the iframe, resize the body of the parent aka the document that has the iframe’s body..
Body <------------------------
Iframe |
Page |
Link... Upon Click, resize body --
How do I do the above? I tried Parent.document.body.style.width = “200px”. and it didn’t work. Not sure what to do. Please Help!
function Parentresize(id)
{
var newheight = 2000;
var newwidth = 2000;
parent.document.getElementById(id).height= (newheight) + "px";
parent.document.getElementById(id).width= (newwidth) + "px";
}
Ok I figured it out. This code will exactly do that. It is a bit lengthy because of extra code for cross browser compatibility:
just call this function
BodyResize(ID)as
<body id="mainbody" onClick="BodyResize('mainbody')">or
<iframe id="interframe" onClick="BodyResize('interframe')">