View Full Version : multiple targeted links in frames?
annecs
Tue 6th Jan '04, 11:48pm
I have a simple 2 row frame set. i would like to be able to click on a link in one frame that will change both. is this possible and how?
thanks
t c
Wed 7th Jan '04, 3:39am
If I am not mistaken you can do this with javascript.
Lets say you have 2 frames, frame1 and frame2, now proceed....
<a href="javascript:;" onclick="document.frame1.location.href='HTTP://WWW.URL1.COM';document.frame2.location.href='HTTP://WWW.URL2.COM'">parent link</a>
Just change the 2 URLs and the link name and you will be all set. :)
diades
Wed 7th Jan '04, 6:40am
Hi Guys
It is better to use the void operator in the href attribute
<a href="javascript:void(0);" onclick="document.frame1.location.href='HTTP://WWW.URL1.COM';document.frame2.location.href='HTTP://WWW.URL2.COM'">parent link</a>
annecs
Wed 7th Jan '04, 10:23am
I have a simple 2 row frame set. i would like to be able to click on a link in one frame that will change both. is this possible and how?
thanks
I received a positive response. Told to use either:
<a href="javascript:void(0);" onclick="document.frame1.location.href='HTTP://WWW.URL1.COM';document.frame2.location.href='HTTP://WWW.URL2.COM'">parent link</a>
<a href="java_script_:;" onclick="document.frame1.location.href='HTTP://WWW.URL1.COM';document.frame2.location.href='HTTP://WWW.URL2.COM'">parent link</a>
question: here is my code for an item in the image map. How would i insert the above in the below. thanks in advance
<area shape="rect" coords="189,17,280,32" href="resume.html" target="mainFrame">
t c
Wed 7th Jan '04, 10:58pm
add the part of the code from onclick="... to the other "
if this doesn't work you will need to put the code in place of resume.html but will have to add javascript: in front. example is below
#1:
<area shape="rect" coords="189,17,280,32" href="javascript:void(0);" onclick="document.frame1.location.href='HTTP://WWW.URL1.COM';document.frame2.location.href='HTTP://WWW.URL2.COM'">
or
#2:
<area shape="rect" coords="189,17,280,32" href="javascript:document.frame1.location.href='HTTP://WWW.URL1.COM';document.frame2.location.href='HTTP://WWW.URL2.COM'">
annecs
Wed 7th Jan '04, 11:59pm
thanks for trying t c. I tried your example last night and nothing happened on a text link. i tried a text link w/a function and finally got that to work. But i decided i really want an image map so the text won't move at all. I just tried both of your possible solutions changing the href locations and nothing happens. as i look at your suggestion, i wonder how it knows which is frame 1 or 2? have you tried these possibilities?
thanks so much for trying. i would love to get this to work.
anne
diades
Thu 8th Jan '04, 11:18am
thanks for trying t c. I tried your example last night and nothing happened on a text link. i tried a text link w/a function and finally got that to work. But i decided i really want an image map so the text won't move at all. I just tried both of your possible solutions changing the href locations and nothing happens. as i look at your suggestion, i wonder how it knows which is frame 1 or 2? have you tried these possibilities?
thanks so much for trying. i would love to get this to work.
anne
Change "frame1" & "frame2" to the name of your frames
t c
Thu 8th Jan '04, 8:07pm
I didn't test the codes on image mapping but as for a text link, I did test and they do work. All you need to do for a text link is change the frame1 & frame2 plus the 2 links. It should work with the image map but, if it doesn't, you can make a function to change both of the frames and then just do this:
<script language="javascript">
<!--
function chgFrames() {
document.frame1.location.href='HTTP://WWW.URL1.COM';
document.frame2.location.href='HTTP://WWW.URL2.COM';
}
// -->
</script>
<area shape="rect" coords="189,17,280,32" href="javascript:chgFrames();">
I didn't test this but I am sure you get the idea.
annecs
Thu 8th Jan '04, 8:58pm
I didn't test the codes on image mapping but as for a text link, I did test and they do work. All you need to do for a text link is change the frame1 & frame2 plus the 2 links. It should work with the image map but, if it doesn't, you can make a function to change both of the frames and then just do this:
<script language="javascript">
<!--
function chgFrames() {
document.frame1.location.href='HTTP://WWW.URL1.COM';
document.frame2.location.href='HTTP://WWW.URL2.COM';
}
// -->
</script>
<area shape="rect" coords="189,17,280,32" href="javascript:chgFrames();">
I didn't test this but I am sure you get the idea.
i tried a changeFrame function with a text link but couldn't figure out the syntax for the image map. will try. THANKS, anne
ok, i am back....
i tried the changeFrame with no luck. Then i tried this function. In an Aol browser things changed but only in one place and in IE nothing happened:
<script language="javascript">
<!--
function setFrames(newPage) {
parent.content.document.location.href = "main" + newPage + ".html"
document.location.href = "nav" + newPage + ".html"
}
// -->
</script>
<area shape="rect" coords="189,17,280,32" href="javascript:setFrames('1');">
i would be glad to send you some test files i am working w/to see if you can figure it out....let me know tc and thanks again.
anne
t c
Fri 9th Jan '04, 4:57am
Send me the test files in which you want me to work with and I will get you a working solution. :)
Please send to: TCorvin@Earthlink.net
I will have it working asap.
Bacon Bits
Thu 29th Jan '04, 1:25am
to clarify, the above codes in the first 2 replies would work on 3 or 4 frames just as well as 2? And can this code be done with iframes too? If so, this thread just saved me a lot of time
vBulletin® v3.8.0 Beta 3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.