Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Links

Status
Not open for further replies.

greyone

Programmer
Dec 14, 2000
200
CA
Hi
I have a link in a frame called Next. Now i want the link to lead me to a different page everytime i click it without refreshing the page or the frame. Is this possible?
Here is an example of what i want to do:

frame1 | frame2
|
| hello.html
Next | hello2.html
| hello3.html
|

The first click on the Next link will load up hello.html. Next click will load hello2.html and so on.

Please help.

 
in the HEAD tag of frame1 put
Code:
<BASE target=&quot;frame2&quot;>

Now on the Next link have this code...

Code:
<A HREF=&quot;javascript:changePage()&quot;>Next</A>


put the function changePage() inbetween script tags in the HEAD tags. Like this...


Code:
<SCRIPT language=&quot;JavaScript&quot;>
var helloCounter = 0;
var helloArray = new Array(&quot;hello.html&quot;, &quot;hello2.html&quot;, &quot;hello3.html&quot;);
function changePage()
{
 if (helloCounter < 3)
 {
  top.frames[&quot;frame2&quot;].location = helloArray[helloCounter];
  helloCounter+=1;
 }
 else
  helloCounter = 0;
}
</SCRIPT>


hope this helps.


Klae

You're only as good as your last answer!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top