Assume only one frame, without id or name:
document.getElementsByTagName("iframe")[0].src = "http://new.url";
If the current frame location is at the same domain:
frames[0].location.href = "http://new.url";
If you have multiple frames, it's very wise to attach an ID to it. When you want to access the frame through the frames
object, set a name:
<iframe id="myframe" name="a_frame_name" src="script.page"></iframe>
JavaScript:
document.getElementById("myframe").src = "newpage.php";
frames.a_frame_name.location.href = "newpage.php";
frames["a_frame_name"].location.href = "newpage.php";
Note: frames[..].location.href
can only be changed if the main page and the frame's location are at the same host, due to the Same Origin policy.