How to Call an iFrame Through a Form
- 1). Open your HTML document in a text or HTML editor.
- 2). Add a unique ID attribute to the iframe, if one doesn't already exist. Your iframe should read:
<iframe src="http://somewebsite.com"></iframe> - 3). Create a new button in your form by adding:
<input type='button' value='Click Here' /> - 4). Add an onclick event to the button you just created containing JavaScript to change the URL (src) of the iframe. Your button should read:
<input type="button" value="Click here" onclick="document.getElementById('your_frame_id').src='http://newwebsite.com/';" /> - 5). Load the page in your Web browser and test the code by clicking the form button your created. The iframe should load the new URL.
Source...