Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to add a combo box dynamically at run time in Java
script?

Answer Posted / thara kv

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Untitled Document</title>
<script>
function add()
{
var tbl = document.getElementById('myTable');
var lastRow = tbl.rows.length;
var row = tbl.insertRow(lastRow);

var m=1;
var cellRightSel = row.insertCell(0);
var sel1 = document.createElement('select');
sel1.name = 'item';
sel1.id='item' ;
sel1.options[0] = new Option('Select An Item', '0');
for(f=0;f<5;f++)
{
var q='item-'+f;
sel1.options[m] = new Option(q,f);
m++
}
cellRightSel.appendChild(sel1);
}

</script>
</head>

<body>
<input type="button" value="ADD" onClick="add()">
<table id="myTable">

</table>
</body>
</html>

Is This Answer Correct ?    42 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is encodeuri() function?

1008


How to get checkbox status whether it is checked or not?

879


How to enabled 'Strict' mode in JavaScript?

1096


Can array in javascript be extended?

847


What does === mean in js?

859


What is an example of javascript?

939


How do I view javascript files in chrome?

884


What does the isNaN() function?

908


Explain the unshift() method ?

896


What is isnan in javascript?

981


What does the term sticky session mean in a web-farm scenario?

934


How can I learn coding fast?

931


What are math constants and functions using javascript?

949


Is dart better than javascript?

866


What does the instanceof operator do?

967