[SOLVED] refresh an iframe...
Moderator: General Moderators
[SOLVED] refresh an iframe...
em, i've two iframe,
first iframe (called "sform") is a form that allow user to submit opinion
second iframe (called "box") is display all the opinion
(something like chatbox)
the problem is, after i submit the form, i want to refresh the second iframe to update the information...
how can i do that, can i use php? or javascript?
tq!!!
first iframe (called "sform") is a form that allow user to submit opinion
second iframe (called "box") is display all the opinion
(something like chatbox)
the problem is, after i submit the form, i want to refresh the second iframe to update the information...
how can i do that, can i use php? or javascript?
tq!!!
Last edited by kevin7 on Wed Oct 06, 2004 10:09 pm, edited 1 time in total.
reset the src.
you will have to reset the src tag of the second Iframe.
using JS you can trigger an event from the returning 1st frame to reset the source of the second iframe.
you will have to do some messy variable passing, but it can be done.
If you need more help, repost and I can share some of my ugly code to get it done with you.
using JS you can trigger an event from the returning 1st frame to reset the source of the second iframe.
you will have to do some messy variable passing, but it can be done.
If you need more help, repost and I can share some of my ugly code to get it done with you.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
yes, this is done through Javascript. You can do I believe.
Code: Select all
top.box.document.location.reload()- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
could need or similar..
Code: Select all
top.framesї index of the frame ].location.reload()in your form iframe do some kind of trigger like
then create a javascript function like
where 'box' is the id of your second iframe.
the parent refers to the parent page of the Iframe then the rest is straight forward.
phpScott
Code: Select all
<body onload="setboxsrc()">Code: Select all
function setboxsrc()
{
parent.document.getElementById('box').src="chatbox.php";
}the parent refers to the parent page of the Iframe then the rest is straight forward.
phpScott
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
<?php session_start();
$_SESSIONї'counter'] = (!isset($_SESSIONї'counter']) ? 0 : intval($_SESSIONї'counter']) + 1);
if(!isset($_GETї'frame']))
{
echo <<<STOP
<html>
<head>
<title>main page</title>
</head>
<body>
{$_SESSIONї'counter']}<br />
<iframe name="sform" src="{$_SERVERї'SCRIPT_NAME']}?frame=1" width="200" height="200">iframe</iframe>
<iframe name="box" src="{$_SERVERї'SCRIPT_NAME']}?frame=2" width="200" height="200">iframe</iframe>
</body>
</html>
STOP;
}
elseif($_GETї'frame'] == 1)
{
echo <<<STOP
<html>
<head>
<title>main page</title>
</head>
<body>
sform<br />
{$_SESSIONї'counter']}<br />
<a href="javascript:top.framesї'box'].document.location.reload()">reload other iframe</a>
</body>
</html>
STOP;
}
else
{
echo <<<STOP
<html>
<head>
<title>main page</title>
</head>
<body>
box<br />
{$_SESSIONї'counter']}<br />
</body>
</html>
STOP;
}
?>