SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    drop menu --too embarassed to ask

    Simply want a drop menu that takes the user to a .php page

    what I have is something like this:

    <form name="form1" action="">
    <select name="menu1" size="1" onselect="MM_jumpMenu('parent',this,0)">
    <option value="../201.php">201</option>
    <option value="../202.php">202</option> </select>
    <input name="Search " type="button" onClick="MM_jumpMenuGo('menu1','parent',0)" value="Go">
    </form>

    Is this not working because its . php or do I need to go in for a checkup?

  2. #2
    SitePoint Addict KelliShaver's Avatar
    Join Date
    Mar 2003
    Location
    Morehead, KY
    Posts
    308
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What's your javascript look like?

  3. #3
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <script language="JavaScript" type="text/JavaScript">
    <!--


    function MM_jumpMenu(targ,selObj,restore){ //v3.0
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;
    }
    //-->
    </script>

  4. #4
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    some reason MX inserted that.

    beleive it should be options with the entire www.'s
    -----------------------------------------

    <script language="JavaScript" type="text/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) { //v4.01
    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);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
    }
    function MM_jumpMenuGo(selName,targ,restore){ //v3.0
    var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
    }
    //-->
    </script>
    ---------------
    you'r right, thanks!

  5. #5

    Join Date
    Oct 2003
    Location
    €uroLand
    Posts
    1,340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess you want something like this
    HTML Code:
    <form name="form1" action="redirect.php" method="get">
      <select name="menu1" size="1"> 
        <option value="201">201</option>
        <option value="202">202</option>
      </select>
      <input name="Search" type="Submit" value="Go">
    </form>
    and redirect.php
    PHP Code:
    <?
        header
    ('Location: ../'.$_GET['menu1'].'.php');
    ?>

  6. #6
    SitePoint Addict trogdor1024's Avatar
    Join Date
    Oct 2004
    Location
    New Jersey
    Posts
    235
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is this what you are looking for?

    http://www.w3schools.com/js/tryit.as...yjs_selectmenu

  7. #7
    SitePoint Addict KelliShaver's Avatar
    Join Date
    Mar 2003
    Location
    Morehead, KY
    Posts
    308
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're over complicating things.... If all you want to do is change pages when you select an item in the jump box, jsut do this:

    Code:
    <form name="jumpBox" action="">
        <select name="nav" onchange="location=document.jumpBox.nav.options [document.jumpBox.nav.selectedIndex].value;">
            <option selected="selected">Select A Page</option>
            <option value="/page1.html">Page 1</option>
            <option value="/page2.html">Page 2</option>
            <option value="/page3.html">Page 3</option>
        </select>
    </form>

  8. #8

    Join Date
    Oct 2003
    Location
    €uroLand
    Posts
    1,340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Guys, this is a PHP group, so please PHP solutions. Otherwise http://www.sitepoint.com/forums/forumdisplay.php?f=15


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
  •