Results 1 to 2 of 2

Thread: Link changes select value.

  1. #1
    Join Date
    May 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Link changes select value.

    Ive been searching for hours now but not found an answer to this one. What i want to do is when someone clicks a link, it changes the value in the select box.

    So far i have come up with:
    Code:
    <script type="javascript">
    function changeSelect(x) {
        document.getElementById("type").value = x;
    }
    </script>
    
    <a href="javascript:changeSelect(1)">Link</a>
    However that doesn't work. Any help would be appreciated, cheers.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Code:
    document.getElementById("type").options.selectedIndex=x;
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •