Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    6
    Thanks
    3
    Thanked 0 Times in 0 Posts

    onChange function dropdown to link

    Hi there,

    I have a drop down menu that runs a function when one of the options are chosen. Is there a way to have this run from individual links?

    <select name="users" onChange="showUser(this.value)">
    <option value="">Select a Deer:</option>
    <option value="1">8002</option>
    <option value="2">8009</option>
    <option value="3">8011</option>

    Thanks

    Rich

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,310
    Thanks
    203
    Thanked 2,563 Times in 2,541 Posts
    Quote Originally Posted by rico01 View Post
    Hi there,

    I have a drop down menu that runs a function when one of the options are chosen. Is there a way to have this run from individual links?

    <select name="users" onChange="showUser(this.value)">
    <option value="">Select a Deer:</option>
    <option value="1">8002</option>
    <option value="2">8009</option>
    <option value="3">8011</option>

    Thanks

    Rich
    Is this what you want?

    Code:
    <a href= "#" onclick = showUser(1); return false;>8002</a>
    <a href= "#" onclick = showUser(2); return false;>8009</a>
    <a href= "#" onclick = showUser(3); return false;>8011</a>
    
    <script type = "text/javascript">
    function showUser(which) {
    alert (which);
    }
    </script>

    I can't remember a start like this in living memory. - Sky Sports

  • Users who have thanked Philip M for this post:

    rico01 (12-14-2010)

  • #3
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    6
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Thanks for your reply mate,

    It works perfectly

    Cheers!

    RIch


  •  

    Posting Permissions

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