1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Javascript drop down menu onclick go to URL

Discussion in 'Web Design & Development' started by scrubbicus, Aug 14, 2009.

Thread Status:
Not open for further replies.
  1. scrubbicus

    scrubbicus Thread Starter

    Joined:
    Jan 23, 2009
    Messages:
    197
    I found a script that apparently worked but for some reason it only works on one page. I have the Javascript in the index.php (between <head> </head>) and all my pages are included into the content section so every page receives the same treatment but for some reason it only works on one page.

    Does anyone have a script that can do this? I'm looking for something simple that I can have a drop down menu with and each option, when selected, will go to a URL. It'll be an action drop down menu so each option will be something like delete, move to trash, make unread and such.

    If anyone can help me out that would be great. Here's my current javascript.

    <form name="guideform">
    <select name="guidelinks" onchange="window.location = document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value">
     
  2. amanxman

    amanxman

    Joined:
    Mar 28, 2006
    Messages:
    690
    Hey,

    Very simple onclick, go to xxxx js:

    Code:
    <div class="xxxx" onclick="GoTo('url.html')">
    
    And then you need to call a js file, with the following:

    Code:
    // GoTo fuction
    function GoTo(url)
    {
    	window.location.href = url;
    }
    
    Not sure if that's exactly the kind of thing you need - but it might be -- for your drop down, you'll be able to assign the onclick to whatever elements make up your drop down, be it <divs> or <li> or whatever

    Hope it helps
     
  3. scrubbicus

    scrubbicus Thread Starter

    Joined:
    Jan 23, 2009
    Messages:
    197
    Awesome thanks.

    That is really easy.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - Javascript drop down
  1. darshit
    Replies:
    1
    Views:
    437
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/852440

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice