How can I dynamically change the height of an iFrame?

HTML how do this drop down iframe code with a image/submit button?

  • This code is supposed to change the iframe page when you change the option, it works perfectly, but being inexperienced with HTML, I'm trying to figure out how to make it work with an image or submit button? Here's the code: <select name="dest" onchange=" window.open(this.options [this.selectedIndex].value, 'myIFrame')"> <option>Choose a destination for your IFrame!</option> <option value="http://www.yahoo.com/"> YAHOO</option> <option value="http://www.google.com/"> GOOGLE</option> <option value="http://www.altavista.com/"> ALTAVISTA</option> <option value="http://www.amazon.com/"> AMAZON</option> <option value="http://artlung.com/" >ARTLUNG</option> </select> </form> <iframe src="http://joecrawford.com/" name="myIFrame" width="400" height="200"> You can't see this because your browser does not support iframes. </iframe>

  • Answer:

    This might seem difficult at first, but it's really simple since you've already written most of the code =P What you need to do is move select's onchange function to form's onsubmit function, (But you need to return false, so that the form doesn't submit, as well as refer to select as "this.dest" instead of just "this".) so instead, you have: <form action="" onsubmit="window.open(this.dest.options [this.dest.selectedIndex].value, 'myIFrame'); return false;"> <p><select name="dest"> <option>Choose a destination for your IFrame!</option> <option value="http://www.yahoo.com/"> YAHOO</option> <option value="http://www.google.com/"> GOOGLE</option> <option value="http://www.altavista.com/"> ALTAVISTA</option> <option value="http://www.amazon.com/"> AMAZON</option> <option value="http://artlung.com/" >ARTLUNG</option> </select></p> <ul id="submits"> <li><button type="submit">Go!</button></li> <li><input type="image" src="go-button" alt="Go!" /></li> </ul> </form> …Later on… <iframe src="http://joecrawford.com/" name="myIFrame" width="400" height="200"> You can't see this because your browser does not support iframes. </iframe> Tell me if it doesn't work, but it should =P Then again, this is off the top of my head. I hope that this helped!

Jacob C at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.