Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Iframe size

Status
Not open for further replies.

GaryC123

Programmer
Sep 10, 2002
1,041
NO
I have an index page with an iframe, when the visitor submits some dates the page source in the iFrame is changed but i need to be able to set its resize it after processing some asp code, by passing a variable containing the height I need, so all the data sits in the frame with no scrollbars (bar the ones on the browser of course). I assume this involves some java but dont know enough to program this myself. Any help (Tarwn? :eek:)) Saturday 12.00
im6.gif
im2.gif
im2.gif
20.00
im5.gif
im4.gif
im7.gif
3.00am
im8.gif
Sunday [img http
 
How about writing a function in the parent page:
Code:
function resizeFrame(width,height){
   document.getElementById("frameid").style.width = width;
   document.getElementById("frameid").style.height = height;
}
The you could call that from the parent with the correct width and height values, or from the page in the child during onLoad:
Code:
<body onLoad=&quot;parent.resizeFrame(450,200);&quot;>
With of course, any numbers you want in it. Since yuor doing it onload than you could estimate the numbers in your asp and write them to the onload event:
Code:
<body onLoad=&quot;parent.resizeFrame(<%=newWidth%>,<%=newHeight%>);&quot;>

Tada! :)

-Tarwn
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
With enough resources, time, and coffee, anything is possible.
 
Got a problem
Placed the function on the parent form and the body onload in the iFrame. (The iframe is accessing a page on another server if that makes a difference)
But when the page loads it says...
Operation is not allowed when the object is closed

Any ideas? Saturday 12.00
im6.gif
im2.gif
im2.gif
20.00
im5.gif
im4.gif
im7.gif
3.00am
im8.gif
Sunday [img http
 
Asp error or javascript error? --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...) :p
 
Browser &quot;cross domain&quot; security block.

Basically happens when the loaded url is on another http path it blocks script calls.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top