SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Newbie Question

  1. #1
    SitePoint Addict trinity0159's Avatar
    Join Date
    Jul 2002
    Location
    California
    Posts
    239
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Newbie Question

    Hello,

    I was wondering if someone could tell me how to create a variable that pulls the value from a select form element.

    Thanks,
    Katrina

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code HTML4Strict:
    <select id="fruit" name="fruit">
      <option value="a">Apples</option>
      <option value="o">Oranges</option>
    </select>
    Code JavaScript:
    var fruit = document.getElementById("fruit").value;
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Addict trinity0159's Avatar
    Join Date
    Jul 2002
    Location
    California
    Posts
    239
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks!


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
  •