I've created a local web page which uses frames, and I want to be able to change the URL of frame2 from frame1.
Frame1 contains a button which when clicked should change the URL of frame2 to Google's home page. Frame1 also contains a textbox which I was using to check if the OnClick event was triggering ok, and it is, but Frame2 doesn't change to Google. Can anyone help me to get this working?
Here's the code for the parent document:
----------------------------
<html>
<head>
<script type="text/javascript">
function populateFrames()
{
frame1.location = "frame1.html";
}
</script>
</head>
<frameset cols="*,*" name="fraSet" id="fraSet" onload="populateFrames()">
<frame name="frame1" id="frame1">
<frame name="frame2" id="frame2">
</frameset>
</html>
----------------------------
Here's the code for frame1:
----------------------------
<html>
<head>
</head>
<body>
<form>
<input type="button" onclick="parent.document.getElementById('frame2').location = ' txt1.value='Hello';" value="Load URL">
<input type="textbox" id="txt1" name="txt1">
</form>
</body>
</html>
----------------------------
Frame1 contains a button which when clicked should change the URL of frame2 to Google's home page. Frame1 also contains a textbox which I was using to check if the OnClick event was triggering ok, and it is, but Frame2 doesn't change to Google. Can anyone help me to get this working?
Here's the code for the parent document:
----------------------------
<html>
<head>
<script type="text/javascript">
function populateFrames()
{
frame1.location = "frame1.html";
}
</script>
</head>
<frameset cols="*,*" name="fraSet" id="fraSet" onload="populateFrames()">
<frame name="frame1" id="frame1">
<frame name="frame2" id="frame2">
</frameset>
</html>
----------------------------
Here's the code for frame1:
----------------------------
<html>
<head>
</head>
<body>
<form>
<input type="button" onclick="parent.document.getElementById('frame2').location = ' txt1.value='Hello';" value="Load URL">
<input type="textbox" id="txt1" name="txt1">
</form>
</body>
</html>
----------------------------