I have an iFrame that contains some Web pages. I can use regular <A> links or forms to switch between the pages inside the iFrame. I want to have a button that when clicked does the same thing... loads the iFrame with a different page. I tried the following but it loads the new page into the whole browser page, not just the iFrame: <BUTTON TYPE="button" onClick="parent.location='http://MyDomain/MyNewPage'">Go There</BUTTON>
delete parent in the "onclick" event, so it will be like that : <button onclick="location='http://mydomain/..'">Go There</button> HTML: But I wouldn't recommend you use buttons as links because it is not semantic.
Hi, The target= parameter may be what you're after. If you give the iframe a name, then reference the name in the call to the new page EG: <iframe name="myiframe".... <a hef=.... target="myiframe".... Hope this helps
budster is right, If you have the name in the iframe.... <iframe name="frame1"... Then your function will be: onclick="frame1.location='http://page.html'"