Click to See Complete Forum and Search --> : How do I change the contents of two frames with one link?


kthorn
06-27-2005, 01:26 PM
I have a simple frameset of two columns; the first having two rows. By default (if I am correct) a browser sees the first frame as [0], the next as [1], and then [2], and so on for as many frames in the frameset.

This code works fine by clicking on the button, the second row of the first column changes, as well as the content in column two.

<form>
<input type="button" Value="Chapter 1"
onClick="parent.frames[1].location='sublinks1.htm';
parent.frames[2].location='chap1.htm';">
</form>

What I want to do is this very same action, but with a typical text link or image, not a forms button. I've tried the <a onCLick=".....">Chapter 1</a> but it doesn't recognize the sctipt between the <a> tags.

Any suggestions?

Thanks!

crh3675
06-27-2005, 01:49 PM
<a href="#" onclick="parent.frames[1].location='sublinks1.htm';parent.frames[2].location='chap1.htm';return false">update both</a>


Make sure to "return false" after your multiple statements so the event bubbling ignores the actual "link click'

kthorn
06-27-2005, 04:07 PM
Hey Thanks!

I tried building a function and then calling it with <a href=" javascript:loadframes()">Linkname</a>, but the function only refers to those two files. I'd have to build a seperate function for each link.

So, it's either that or your suggestion for each link. I like your way as it's right there in the main code where I can manage it.

Thanks a bunch!