Jaimok
09-06-2011, 02:20 PM
Hello,
I have two frames, one to the left, one to the right.
The left one contains a form, which I'm using to take in user input, and at the same time to refresh the frame on the right.
The left frame's code is:
<html>
<head>
<script type="text/javascript">
function reload_right_frame()
{
parent.right_frame.location.reload();
}
</script>
</head>
<form method="post">
<input type="submit" value="Enter" onClick="reload_right_frame();">
<input type='text' name='userinput'>
</form>
<?php
echo "You entered: " . $_POST['userinput'];
?>
</html>
This succeeds in spewing out what the user entered, and simultaneously refreshing the right-hand frame.
However, I want there to be a delay in refreshing the right-hand frame, so I changed the left-frame coding as follows:
<html>
<head>
<script type="text/javascript">
function delayed_reload()
{
var t=setTimeout("reloadframe()",3000);
}
function reload_right_frame()
{
parent.right_frame.location.reload();
}
</script>
</head>
<form method="post">
<input type="submit" value="Enter" onClick="delayed_reload();">
<input type='text' name='userinput'>
</form>
<?php
echo "You entered: " . $_POST['userinput'];
?>
</html>
This is where it stops working. The right-hand frame is not reloaded at all. I want it to reload after 3 seconds. The user input text is spewed out, though.
If I change the input type from "submit" to "button", however, the delayed reload of the right-hand frame works fine, but then the user input text fails to show.
How can I make both form and delayed reload both work? I'm probably missing something obvious.
Thanks in advance for any help!
I have two frames, one to the left, one to the right.
The left one contains a form, which I'm using to take in user input, and at the same time to refresh the frame on the right.
The left frame's code is:
<html>
<head>
<script type="text/javascript">
function reload_right_frame()
{
parent.right_frame.location.reload();
}
</script>
</head>
<form method="post">
<input type="submit" value="Enter" onClick="reload_right_frame();">
<input type='text' name='userinput'>
</form>
<?php
echo "You entered: " . $_POST['userinput'];
?>
</html>
This succeeds in spewing out what the user entered, and simultaneously refreshing the right-hand frame.
However, I want there to be a delay in refreshing the right-hand frame, so I changed the left-frame coding as follows:
<html>
<head>
<script type="text/javascript">
function delayed_reload()
{
var t=setTimeout("reloadframe()",3000);
}
function reload_right_frame()
{
parent.right_frame.location.reload();
}
</script>
</head>
<form method="post">
<input type="submit" value="Enter" onClick="delayed_reload();">
<input type='text' name='userinput'>
</form>
<?php
echo "You entered: " . $_POST['userinput'];
?>
</html>
This is where it stops working. The right-hand frame is not reloaded at all. I want it to reload after 3 seconds. The user input text is spewed out, though.
If I change the input type from "submit" to "button", however, the delayed reload of the right-hand frame works fine, but then the user input text fails to show.
How can I make both form and delayed reload both work? I'm probably missing something obvious.
Thanks in advance for any help!