SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Sep 2000
    Location
    Ontario, Canada
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have a drop-down menu within a frame that is spawed with a href="#" on a button. I have it set up so when you click the button that spawns a page in the content frame.

    Problem is that 1 of the buttons needs to open a new window. I can't use a target=_top or whatever 'cuz that would just load the navigation again.

    I tried this but it just loads it in the same window:
    ... onmouseup="top.location.href='url.com'; ...

    Any ideas? Thanks in advance!
    Jason Dulberg
    Extreme MTB
    http://extreme.nas.net

  2. #2
    SitePoint Member JohnP's Avatar
    Join Date
    Sep 1999
    Location
    Texas
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try:

    onMouseUp="window.open('url.com');"

    That should do the trick.

  3. #3
    SitePoint Addict
    Join Date
    Sep 2000
    Location
    Ontario, Canada
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your suggestion. Just tried it but it didn't load the new window. Is there anything else that I can try?
    Jason Dulberg
    Extreme MTB
    http://extreme.nas.net

  4. #4
    SitePoint Member JohnP's Avatar
    Join Date
    Sep 1999
    Location
    Texas
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you can post the code for your navigation or the URL, I'll see if I can figure it out.

  5. #5
    SitePoint Addict
    Join Date
    Sep 2000
    Location
    Ontario, Canada
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its a work in progress so unfortuntely, there's no online version so I gotta give all the code here.

    Ok, here's the button that should spawn the dropdown menu and when the actual button is clicked, should open a window.

    <A onmouseover="menu('multimedia','','show','ileft','','show','ilower','','show','iright','','show','itop','','show','art','','hide','ahist','','hide','drama','','hide','music','','hide','home','','hide')"
    href="#" onmouseup="window.open=('url.com');"><img src="fx/nav/multimedia.jpg" width="134" height="15" border="0" alt="Multimedia"></a></TD>

    ileft, ilower etc, are the areas that when moused over, the dropdown menu will close.

    Here is the js that is called by "menu"

    function MM_findObj(n, d) {
    var p,i,x; if(!d) d=document;
    if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n];
    for(i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
    }

    function tmt_findObj(n){
    var x,t;
    if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
    x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
    }
    else{x=document.getElementById(n)}
    return x;
    }

    function menu() {
    var i,p,v,obj,args=menu.arguments;
    if(document.getElementById){
    for (i=0; i<(args.length-2); i+=3){
    obj=tmt_findObj(args[i]);v=args[i+2];
    v=(v=='show')?'visible'v='hide')?'hidden':v;
    if(obj)obj.style.visibility=v;}}
    else{
    for (i=0; i<(args.length-2);i+=3)
    if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible'v='hide')?'hidden':v; }
    obj.visibility=v;}
    }
    }


    Here is the <div> tag for what the menu item looks like:
    <div id=multimedia style="Z-INDEX: 3; LEFT: 290px; VISIBILITY: hidden; WIDTH: 100px; POSITION: absolute; TOP: 47px; HEIGHT: 1px">

    Its one of those Dreamweaver made scripts so that might be what the problem is.

    I appreciate your help with this!!
    Jason Dulberg
    Extreme MTB
    http://extreme.nas.net

  6. #6
    SitePoint Member JohnP's Avatar
    Join Date
    Sep 1999
    Location
    Texas
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Take out the 2nd = sign in:

    onmouseup="window.open=('url.com');"

    so it reads:

    onmouseup="window.open('url.com');"

    and see if it pops the window then. If not, I'll take a closer look at the rest of the code also.

  7. #7
    SitePoint Addict
    Join Date
    Sep 2000
    Location
    Ontario, Canada
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Works like a charm!!! I can't believe I didn't notice that! Such a stupid error. Guess the stupid errors are always the one's that cause the headaches.

    Thanks again!
    Jason Dulberg
    Extreme MTB
    http://extreme.nas.net


Bookmarks

Posting Permissions

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