DEMO of Adding options to List Box

You can see the view-> Source of this page.

Adding elements to List box | List box | Selecting one default option

JavaScript

<script language="javascript">

function addOption(selectbox,text,value )
{
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;
	selectbox.options.add(optn);
}

function addOption_list(){
var month = new Array("January","February","March","April","May","June","July","August","September","October","November","December");

for (var i=0; i < month.length;++i){
addOption(document.drop_list.Month_list, month[i], month[i]);
}

}
</script>
<body onLoad="addOption_list()";>
<FORM name="drop_list" action="yourpage.php" method="POST" >
		
<SELECT  NAME="Month_list">
<Option value="" >Month list</option>
</SELECT>
</form>

Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com




    Post your comments , suggestion , error , requirements etc here .




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer