Drop Down Menu with Sub Menu but open as pop-up

Discussion in 'HTML & Website Design' started by zille, Oct 12, 2013.

  1. #1
    I am using a HTML code to create a drop down menu for my site.

    The menu shows like this:
    Screen Shot 2013-10-13 at 11.35.35 AM.png
    The problem is when I select any of the menu, suppose say select "store" a new popup page will open. I want the page to be open in the same window.
    Can anyone tell me how to change the code to open select page (as url) to be open in the same window. My current code is:
    <html>
    <head>
    </head>
    <body>
    <select name="menu1" id="menu1">
    <option value="http://example.com/quiz/">QUIZ</option>
    <option value="http://example.com/ihost">UploadDownload</option>
    <option value="http://example.com/store/">Store</option>
    <option value="http://example.com/index.php?app=arcade">FlashGames</option>
    <option value="http://example.com/blogs/">Blog</option>
    <option value="http://example.com/membermap/">BDMAP</option>
    </select>
    <script type="text/javascript">
    var urlmenu = document.getElementById( 'menu1' );
    urlmenu.onchange = function() {
          window.open( this.options[ this.selectedIndex ].value );
    };
    </script>
    </body>
    </html>
    HTML:

     
    zille, Oct 12, 2013 IP
  2. hdewantara

    hdewantara Well-Known Member

    Messages:
    538
    Likes Received:
    47
    Best Answers:
    25
    Trophy Points:
    155
    #2
    Try this?
    
    <body>
    <select name="menu1" id="menu1" onchange="location.href=this.options[this.selectedIndex].value">
    <option value="http://example.com/quiz/">QUIZ</option>
    <option value="http://example.com/ihost">UploadDownload</option>
    <option value="http://example.com/store/">Store</option>
    <option value="http://example.com/index.php?app=arcade">FlashGames</option>
    <option value="http://example.com/blogs/">Blog</option>
    <option value="http://example.com/membermap/">BDMAP</option>
    </select>
    </body>
    
    HTML:
     
    hdewantara, Oct 12, 2013 IP
  3. zille

    zille Member

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #3
    Thank you very much. Its working perfectly now.
     
    zille, Nov 6, 2013 IP