Jump to content

Populate BirthMonth and Birthday in dropdown list using javascript


Recommended Posts

use this

<html><head>  <title></title>  <script>  onload=  function()  {	var mth = new Array();	mth[0] = "January";	mth[1] = "February";	mth[2] = "March";	mth[3] = "April";	mth[4] = "May";	mth[5] = "June";	mth[6] = "July";	mth[7] = "August";	mth[8] = "Septemeber";	mth[9] = "October";	mth[10] = "November";	mth[11] = "December";		var days = 31;	var i = 0;	var bmth = document.getElementById('bmth');	var bday = document.getElementById('bday');		for(i=0;i<mth.length;i++)	{	  bmth.options[bmth.options.length] = new Option(mth[i],i);	}		for(i=0;i<days;i++)	{	  bday.options[bday.options.length] = new Option(i+1,i+1 );	}  }  </script></head><body>  <select id="bmth"></select> <select id="bday"></select></body></html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...