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
Related Q & A:
- How to Remove DIV from Iframe?Best solution by Stack Overflow
- A code for a comment box?Best solution by Yahoo! Answers
- How do I put an html code in a scroll box?Best solution by html.am
- What's the HTML code for a scroll box on top of a picture?Best solution by Yahoo! Answers
- What does it say on the submit button?Best solution by wiki.answers.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.