PDA

View Full Version : onrelease question



theworldinside
March 13th, 2003, 09:55 PM
how can i make it so when someone clicks on a link, it loads the page in one iframe and changes the image in another?

lostinbeta
March 13th, 2003, 11:10 PM
Just add two getURLS that change the content of each iframe.

on (release){
getURL("content1.html", "iframeName1");
getURL("content2.html", "iframeName2");
}

Jubba
March 13th, 2003, 11:12 PM
I'm not sure they mean in Flash...

lostinbeta
March 13th, 2003, 11:14 PM
Ah, I got to this thread through the new posts area, so I didn't notice the section it was in.

In that case.... You could probably set up a javascript function.


::gets to testing::


::wonders why the title says onrelease then::

lostinbeta
March 13th, 2003, 11:32 PM
Alright I came up with a Javascript way...

Insert this code in between your <HEAD></HEAD> tags of your HTML file.

<SCRIPT LANGUAGE="JavaScript">
<!--
function changeBoth(win1Loc, win2Loc){
document.all.window1.src = win1Loc;
document.all.window2.src = win2Loc;
}
-->
</SCRIPT>

Now you can call the function like this...

<A HREF="JavaScript:void(0);" onClick="JavaScript:changeBoth('win1NewFile.html', 'win2NewFile.html')">Change Both</A>


WHY DOES IT KEEP CHANGING JAVASCRIPT TO ABOUT?!?!?!?!?!

lostinbeta
March 14th, 2003, 12:14 AM
Ok Ok, OF COURSE there has to be Netscape complications :sure:

I fixed that though. Since iframes are only supported by Netscape 6+ I went through the liberty of only browser checking for IE or NS6+, then calling different scripts.



<SCRIPT LANGUAGE="JavaScript">
<!--
function changeBoth(win1Loc, win2Loc){
var IE = document.all;
var NS = !document.all && document.getElementById;
if (IE) {
document.all.window1.src = win1Loc;
document.all.window2.src = win2Loc;
} else if (NS) {
frames['window1'].location.href = win1Loc;
frames['window2'].location.href = win2Loc;
}

}
-->
</SCRIPT>



That is the new script.


And Oh yeah, I forgot. This script assumes your Iframe names are window1 and window2.


This script SHOULD work in IE4+ and NS6+, but I never guarantee anything ;)


Well, if you indeed did mean in Flash as my first post... then oh well, maybe this will help someone else out :P

abzoid
March 14th, 2003, 12:58 PM
Originally posted by lostinbeta
Ok Ok, OF COURSE there has to be Netscape complications :sure:

That's exactly why I HATE using JavaScript, essentially you have to code everything twice. :angry:

lostinbeta
March 14th, 2003, 01:02 PM
Originally posted by abzoid
That's exactly why I HATE using JavaScript, essentially you have to code everything twice. :angry:


Yeah, but it is the price to pay to be a scripter. I like what I do, even though I sometimes have to code for both browsers seperately. :P