selectedindex problem

Results 1 to 2 of 2

Thread: selectedindex problem

  1. #1
    Join Date
    Dec 1969
    Posts
    87

    Default selectedindex problem

    Can anyone tell me why I can&#039t read the selectedindex property from an option list. This example is lifted right out of a Java Script guide. I&#039m simply trying to move the option selected into another form field...<BR>The error occurs in the function display_choice()<BR>It works if I replace the variable &#039chosen&#039 with a number so it must be the first line.<BR><BR>Any help appreciated!<BR><BR>&#060;html&#062;<BR><BR>&#060; head&#062;<BR>&#060;title&#062;New Page 1&#060;/title&#062;<BR>&#060;meta name="GENERATOR" content="Microsoft FrontPage 3.0"&#062;<BR>&#060;/head&#062;<BR>&#060;script&#062;<BR>function display_choice()<BR>{<BR>chosen = document.form1.D1.selectedindex<BR>document.form1. T1.value = document.form1.D1[chosen].text;<BR>}<BR>&#060;/script&#062;<BR><BR><BR>&#060;body&#062;<BR><BR>&# 060;form name="form1" method="POST" action="somefile.asp"&#062;<BR> &#060;p&#062;&#060;select name="D1" size="1" onchange="display_choice()"&#062;<BR> &#060;option value="chioice 1"&#062;chioice 1&#060;/option&#062;<BR> &#060;option value="choice 2"&#062;choice 2&#060;/option&#062;<BR> &#060;option value="choice 3"&#062;choice 3&#060;/option&#062;<BR> &#060;/select&#062;&#060;/p&#062;<BR> &#060;p&#062;&#060;input type="text" name="T1" size="20"&#062;&#060;/p&#062;<BR> &#060;p&#062;&#060;input type="submit" value="Submit" name="B1"&#062;&#060;input type="reset" value="Reset"<BR> name="B2"&#062;&#060;/p&#062;<BR>&#060;/form&#062;<BR>&#060;/body&#062;<BR>&#060;/html&#062;<BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    760

    Default RE: selectedindex ->!! selectedIndex

    Capital I will solve it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •