forms[0]

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pariforum
    New Member
    • Mar 2007
    • 5

    #1

    forms[0]

    Pls explain me following code.

    var cboxlen= document.forms[0].filterfieldnam e[document.forms[0].filterfieldnam e.selectedIndex].value;
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    welcome to scripts .....

    forms[0] means .... there is only one form in the html page

    then filterfieldname means the select (Combo Box) object

    and selectedIndex means the selected index no of the combo box

    value means the value attribute of

    <select name = filterfieldname >
    .....
    <option value = 'Some Value'>some_tex t</option>
    ....
    </select>

    i think u got my point

    welcome again

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Most of the answer is right and is enough for what you need to know.

      Just one thing is incorrect. forms[0] does not mean there is only one form on the page. It is referring to the first form on the page.

      Comment

      Working...