Set a listbox item to be selected

Discussion in 'JavaScript' started by frankiecostello, Jun 6, 2008.

  1. #1
    I have a login for my site, when a user logs in they have verified they are apart of the database. Than a list box is populated with all of the users from the database. When a user is selected from the list box, they're information is dynamically generated at the bottom of the page. When a user logs in, I want to trigger a selection of they're name instantly in the list box which would then dynamically generate their information at the bottom of the page. So I want to "create" my own click event on on the listbox. How can I do that?

    imagine the <option> elements have been dynamically generated by the user logging in.
    
    <select size = "10 id ="list" onchange="dynamic()">
       <option> user1 </option>
       <option> user2 </option>
    </select>
    
    Code (markup):
    How can I write a javascript function that says, "oh this user is logged into our system", select user1 (which would cause dynamic generation of they're info because onchange="dynamic()" is a function which does that).
     
    frankiecostello, Jun 6, 2008 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    try looking on irt.org for an working example! :)
     
    EricBruggema, Jun 7, 2008 IP