<SCRIPT LANGUAGE = “JavaScript”>
<!–

var tennisplayers= new Array(“Safin”, “Andre Agassi”, “Pete Sampras”, “Anna Kournikova”, “Martina Hingis”);
var cricketplayers = new Array(“Sachin Tendulkar”, “Steve Waugh”, “Brian Lara”, “Sir Don Bradman”);

function set_player() {
 
  var select_sport = document.myform.sport;
var select_player = document.myform.player;
var selected_sport = select_sport.options[select_sport.selectedIndex].value;

select_player.options.length=0;
if (selected_sport == “tennis”){
 
    for(var i=0; i<tennisplayers.length; i++) 
    select_player.options[select_player.options.length] = new Option(tennisplayers[i]);
  }
if (selected_sport == “cricket”){
 
    for(var i=0; i<cricketplayers.length; i++)
      select_player.options[select_player.options.length] = new Option(cricketplayers[i]);
  }
}
–>
</SCRIPT>

<BODY>
<FORM NAME=”myform” METHOD=”POST”>

Sport
<SELECT NAME=”sport” onChange=”set_player()”>
<OPTION VALUE=”tennis”>——-
<OPTION VALUE=”tennis”>Tennis
<OPTION VALUE=”cricket”>Cricket
</SELECT>

Player
<SELECT NAME=”player”>
<OPTION>——
</SELECT>

</FORM>
</BODY>