SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2000
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Open in new window

    I have a jump menu that after selected and button is pressed I want it to open in a new window not in the current window.
    I don't know what to chage to make it happen. Here is my code.

    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript">
    <!--
    function MM_jumpMenu(targ,selObj,restore){ //v3.0
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;
    }

    function MM_findObj(n, d) { //v3.0
    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 MM_jumpMenuGo(selName,targ,restore){ //v3.0
    var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
    }
    //-->
    </script>
    </head>

    <body bgcolor="#FFFFFF">
    <form name="form1">
    <select name="menu1" size="4">
    <option value="test.doc" selected>Test1</option>
    <option value="test1.doc" selected>Test2</option>
    </select>
    <input type="button" name="Button1" value="Go" onClick="MM_jumpMenuGo('menu1','parent',0)">
    </form>
    </body>
    </html>

  2. #2
    PHP warrior dkode's Avatar
    Join Date
    Sep 2001
    Location
    Planet Namek
    Posts
    329
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Change this line:
    <input type="button" name="Button1" value="Go" onClick="MM_jumpMenuGo('menu1','parent',0)">

    To this:
    <input type="button" name="Button1" value="Go" onClick="MM_jumpMenuGo('menu1','parent',0)" target="_blank">

    Notice the target="_blank"

    That should work!
    "Mankind cannot define memory, yet it defines mankind"
    -- Project 2501, Ghost in the Shell

    Smarty | PEAR | PHP Manual | MySQL Manual


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
  •