Welcome to WebmasterWorld Guest from 54.145.166.96

Forum Moderators: open

Message Too Old, No Replies

change IFRAME height from javascript inside the iframe

   
7:27 pm on Nov 15, 2007 (gmt 0)

5+ Year Member



I want to have a "minimised" view of an iframe - user clicks a button to reduce the height. the problem I"m running into is that I need to be able to click a link inside of the iframe to do this. It looks similar to the standard _ minimise button in all browsers.
Is there a way to modify the properties of the iframe from INSIDE of the iframe itself? I have done a lot of searching for this, but can't seem to get it right.
thanks
7:45 pm on Nov 15, 2007 (gmt 0)

10+ Year Member



You may have to activate a script on the parent page(the one where the iframe code is).

search for "javascript cross frame scripting" it should be a good start.

2:34 pm on Nov 16, 2007 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



It's possible as long as both the parent and iframe pages are on the same domain!
5:45 pm on Nov 16, 2007 (gmt 0)

5+ Year Member



sorry to take so long to reply.
@Dabrowski - can you elaborate? I am familiar with accessing the main page via "window" and can change the size of the main window via window.top from inside the iframe. My testing with "self" didn't get me there, though.

Is this something you'd use the document object for or window?

these are indeed on the same domain.

6:03 pm on Nov 16, 2007 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



To change the size of the iframe, you'd need to do it from the parent window.

The reason I asked if they were on the same domain is that if they weren't, there would be absolutely no way to 'talk' between them.

You should be able to access that from inside your iframe with:

parent.document.getElementById( "youriframe");
6:14 pm on Nov 16, 2007 (gmt 0)

5+ Year Member



thanks a lot!
 

Featured Threads

Hot Threads This Week

Hot Threads This Month