Change Select List Contents

[Total: 0    Average: 0/5]

This is a simple JavaScript for a form which is a Select List with a list of countries and the second Select List below is a list of States in that country.

Body Code:

<script language="JavaScript1.2">

 function verifyInput() {
 var aa;
 var s,ss;
 var s = myForm1.selectitem1.value; 
 ss = s.split("&");
 for (i = 0; i < ss.length ; i++) {
 myForm1.selectitem2.options[i].text = ss[i];
 } 
 }
 </SCRIPT>
 <form name=myForm1 >

<SELECT  id=selectitem1 name=selectitem1 style="HEIGHT: 66px; LIST-STYLE: square;  WIDTH: 155px" dataFld=""  onChange=verifyInput()>
<option value= Jaffna&Colombo&Kandy>Sri Lanka</option>
<option value= victoria&southaustralia&Sydney>Australia</option>
<option value= Toronto&Montrial&Otawa>Canada</option>
</select>

<SELECT  id=selectitem2 name=selectitem2 style="HEIGHT: 66px; LIST-STYLE: square;  WIDTH: 155px" dataFld="" >
 <OPTION value=>Jaffna</option>
 <OPTION value=>Colombo</option>
 <OPTION value=>Kandy</option>
</select>
</form>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *