Click to See Complete Forum and Search --> : Targeting links to a specific frame using javascript...


icarus1110
12-01-2002, 01:50 AM
Hey there,

I'm having a problem with a javascript navigation menue I'm using on my site. I can't seem to figure out how to target a link to a specific frame. In normal HTML it's simple, just add in target="TOPFRAME" or whatever. However, I'm not too familiar with javascript so I have no idea how to accomplish that same task using js. Can anyone help me out? I'd greatly appreciate it.

You can view the menue at http://www22.brinkster.com/allages01/test.html


Regards,
Matt Reese
http://www.all-ages.tk

gil davis
12-01-2002, 12:42 PM
I believe this is the function from menu_com.js:


function GoTo(){
if(this.LinkTxt){
status='';
var HP=Nav4?this.LowLyr:this;
LowItem(HP);
this.LinkTxt.indexOf('javascript:')!=-1?eval(this.LinkTxt):DcLoc.location.href=this.LinkTxt}}


Change the last line to:

window.top.TOPFRAME.location.href=this.LinkTxt

icarus1110
12-01-2002, 04:48 PM
Originally posted by gil davis
I believe this is the function from menu_com.js:


function GoTo(){
if(this.LinkTxt){
status='';
var HP=Nav4?this.LowLyr:this;
LowItem(HP);
this.LinkTxt.indexOf('javascript:')!=-1?eval(this.LinkTxt):DcLoc.location.href=this.LinkTxt}}


Change the last line to:

window.top.TOPFRAME.location.href=this.LinkTxt

Alrighty, thanks! I'm still kinda confused on how to insert that, though. The current script is:


Menu5=new Array("Links","javascript:void(0)","",2);
Menu5_1=new Array("Bands","bands.html","",0,20,140);
Menu5_2=new Array("Other","otherlinks.html","",0,20,140);

How would I insert what you just showed me to fit into that?

gil davis
12-01-2002, 04:57 PM
Oops! the forum hosed my post. I edited it to eliminate the smiley. However, that does not answer your current question.
Originally posted by icarus1110
Alrighty, thanks! I'm still kinda confused on how to insert that, though. The current script is:


Menu5=new Array("Links","javascript:void(0)","",2);
Menu5_1=new Array("Bands","bands.html","",0,20,140);
Menu5_2=new Array("Other","otherlinks.html","",0,20,140);

How would I insert what you just showed me to fit into that?
I thought you wanted *all* the links to go to the frame. You'll have to tell me what each part of the array means.

icarus1110
12-01-2002, 05:00 PM
Originally posted by gil davis
Oops! the forum hosed my post. I edited it to eliminate the smiley. However, that does not answer your current question.

I thought you wanted *all* the links to go to the frame. You'll have to tell me what each part of the array means.

Well, I do want them to all open in the desired frame. Haha, sorry for any confusion... I have no idea how to do anything with js, just HTML. :)

Alright, so where do I put that script at if it doesn't go where I said?

gil davis
12-01-2002, 06:14 PM
That is exactly what I gave you the first time.