Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HTML
<html>
<head>
<script type="text/javascript">
function setOptions(chosen, selbox) {

selbox.options.length = 0;
if (chosen == " ") {
selbox.options[selbox.options.length] = new Option('Please select one of the options above first',' ');
}

if (chosen == "1") {
	selbox.options[selbox.options.length] = new Option('--Select--','');
	for($i=1; $i<=5; $i++)
	{
		$a=$i+10;
		selbox.options[selbox.options.length] = new Option($a,$a);	
	}
}

if (chosen == "2") {
    selbox.options[selbox.options.length] = new Option('--Select--','');
	for($i=1; $i<=5; $i++)
	{
		$a=$i+20;
		selbox.options[selbox.options.length] = new Option($a,$a);		
	}
}

if (chosen == "3") {
    selbox.options[selbox.options.length] = new Option('--Select--','');
	for($i=1; $i<=5; $i++)
	{
		$a=$i+30;
		selbox.options[selbox.options.length] = new Option($a,$a);		
	}
}

if (chosen == "4") {
    selbox.options[selbox.options.length] = new Option('--Select--','');
	for($i=1; $i<=5; $i++)
	{
		$a=$i+40;
		selbox.options[selbox.options.length] = new Option($a,$a);		
	}
}

if (chosen == "5") {
    selbox.options[selbox.options.length] = new Option('--Select--','');
	for($i=1; $i<=5; $i++)
	{
		$a=$i+50;
		selbox.options[selbox.options.length] = new Option($a,$a);		
	}
}

}
 </script>
</head>
 <body>
<form name="myform">
  <select name="optone"  önChange="setOptions(document.myform.optone.options[document.myform.optone.selectedIndex].value,document.myform.opttwo);">
    <option value=" " selected="selected">-------- Select --------</option>
    <script type="text/javascript">
	  for($i=1; $i<=5; $i++)
	  {
	    document.write("<option value="+$i+">"+$i+"</option>")
	  
	  }
	</script>	
   </select> 

   <select name="opttwo">
    <option value=" " selected="selected">Please select one of the options above first</option>
   </select> 
 </form>
  </body>
 </html>
Posted
Updated 2-Aug-12 1:24am
v2
Comments
_Amy 2-Aug-12 7:25am    
Where is the question? What is the question?
Sebastian T Xavier 3-Aug-12 2:42am    
Just a code dump

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900