Changing frame from one frame to another
Moderator: General Moderators
Changing frame from one frame to another
I have a script where there are two frames
top, and bottom for example.
What I need to do is after a link is clicked in the top frame, the top frame runs it's script, essentially submitting data and reloading itself, and then have the bottom frame change to a different page.
I know a simple target="" is what some of you will say, but I need the top frame to reload itself and run, and the bottom frame to change at the same time. How can I go about doing this?
top, and bottom for example.
What I need to do is after a link is clicked in the top frame, the top frame runs it's script, essentially submitting data and reloading itself, and then have the bottom frame change to a different page.
I know a simple target="" is what some of you will say, but I need the top frame to reload itself and run, and the bottom frame to change at the same time. How can I go about doing this?
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
here's the idea then:
Code: Select all
<a href="e;topframe.php?foo=bar"e; onclick="e;return jumpPage(3);"e;>foo me</a>Code: Select all
var urls = ї 'someurl.php?var=hi', 'someurl.php?var=goodbye', 'other.php?bar=foo', 'another.php?page=12 ];
function jumpPage( i )
{
if( i < urls.length && i >= 0 )
{
var url = urlsї i ];
var bottomFrame = top.framesї1];
bottomFrame.location.href = url;
return true;
}
return false;
}...
Actually, after reviewing my coding, it would be dependant on the top frame. Because I would have to update records in the database on the random URL chosen. Then I would need to have it load in the bottom frame.
Sorry for not clarifying this.
Sorry for not clarifying this.
something like...
Then the onload in the top frame
that?
Code: Select all
function newpage(){
$sitearray = mysql_fetch_array(mysql_query("SELECT url FROM sites WHERE activated = 'y' ORDER BY rand() LIMIT 1")); }Code: Select all
<body onLoad="<? newpage(); ?>">I used this code to generate a random URL to a bottom frame, once a top frame was reloaded.
It works good. My question is, how can I generate a text link in my top frame, that when clicked opens this link in a new window. I don't know how to return the value of the URL generated. <a href="location.href(top.frames[1]" target="_blank"> I tried that, but to no avail.
Code: Select all
<script>
var urls = ї '<? echo $sitesarrayї'url']; ?>' ];
function jumpPage( i ){
if( i < urls.length && i >= 0 ) {
var url = urlsї i ];
var bottomFrame = top.framesї1];
bottomFrame.location.href = url;
return true; }
return false; }
</script>