How do i pass that as a parameter into java script?

Discussion in 'Programming' started by wivngeh, Dec 22, 2011.

  1. wivngeh Member

    Member Since:
    Nov 30, 2011
    Message Count:
    39
    Likes Received:
    0
    hello,

    I've got a problem.i'm in trouble of figuring out when i do the drop down box whatever the person selects how do i pass that as a parameter into java script or can i put the drop down box in the java script?
  2. MarPlo Member

    Member Since:
    May 12, 2011
    Message Count:
    66
    Likes Received:
    6
    Hi,
    You can use an JSON Array type variable, and the values of the option in select list to be keys of the elements in that array.
    Example:
    In JS
    Code (text):
    var a_var = {"opt1":"val 1", "opt2":"val2"}
    Select:
    Code (text):
    <select name="sel">
    <option value="opt1">opt1</option>
    <option value="opt2">opt2</option>
    </seleect>

Share This Page