www.webdeveloper.com
Results 1 to 6 of 6

Thread: Targeting links to a specific frame using javascript...

  1. #1
    Join Date
    Dec 2002
    Posts
    3

    Targeting links to a specific frame using javascript...

    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

  2. #2
    Join Date
    Nov 2002
    Posts
    4,473
    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
    Last edited by gil davis; 12-01-2002 at 05:54 PM.

  3. #3
    Join Date
    Dec 2002
    Posts
    3
    Originally posted by gil davis
    I believe this is the function from menu_com.js:

    Code:
    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?

  4. #4
    Join Date
    Nov 2002
    Posts
    4,473
    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.

  5. #5
    Join Date
    Dec 2002
    Posts
    3
    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?

  6. #6
    Join Date
    Nov 2002
    Posts
    4,473
    That is exactly what I gave you the first time.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles