There are various ways to go about this. The simplest would be a link (doesn't require javascript on the user's end and will work across domains):
Code:
<a href="page2.htm" target="frame1">Page 2</a>
It requires that frame1 have the name 'frame1' not just the id, ex:
Code:
<iframe id="frame1" name="frame1" src="whatever" . . .
Now you could do this (using just the id - requires javascript - may be limited to pages all on the same domain):
Code:
<input type="button" onclick="top.document.getElementById('iframe1').src='page2.htm';">
Or (requires the name attribute and javascript and is limited to pages all on the same domain)
Code:
<input type="button" onclick="top.frames['iframe1'].location.href='page2.htm';">
Or finally, and what I'd recommend (requires name, works with or without javascript, and should work across domains):
Code:
<form action="page2.htm" target="frame1">
<div>
<input type="submit">
</div>
</form>
Bookmarks