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 / augusto vyhmeister

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=windows-1250">
<meta name="generator" content="PSPad editor,
www.pspad.com">
<title></title>
</head>
<body>

<script language="JavaScript" type="text/javascript">

function change(currentbox) {
alert('very complex...to understand');
}

function change1()
{
alert('changing...');
son = document.getElementById("combo_0");
son1 = document.getElementById("combo_1");
son2 = document.getElementById("combo_2");

alert(son.value);

if(son.value == '0') //
{
son1.options.length = 0;
son2.options.length = 0;
}

if(son.value == '1') //
{

son1.options.length = 0;
for (var i=0;i<5;i++)
{
son1.options[i]= new Option("Test"+i,i)
}
}

if(son.value == '2') //
{
son1.options.length = 0;
for (var i=0;i<15;i++)
{
son1.options[i]= new Option("Test"+i,i)
}

}

if(son.value == '2') //
{

son1.options.length = 0;

for (var i=0;i<10;i++)
{

son1.options[i]= new Option("Test"+i,i)
}


}


}


</script>

<form>
<select name="combo0" id="combo_0" onChange="change1
(this);" style="width:200px;">
<option value="0">-select-</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>

</select>
<BR><BR>
<select name="combo1" id="combo_1" onChange="change(this)"
style="width:200px;">
<option value="0">-select-</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<BR><BR>
<select name="combo2" id="combo_2" onChange="change(this);"
style="width:200px;">
<option value="value1"> </option>
</select>
<BR><BR>
<select name="combo3" id="combo_3" onChange="change(this);"
style="width:200px;">
<option value="value1"> </option>

</select>

</form>

<p align="center">This free script provided by<br />
<a href="http://javascriptkit.com"><b
style="color:black;background-color:#a0ffff">JavaScript</b>
Kit</a></p>
<p align="center">And adapted by <br />
<a href="http://www.engelsss.dyndns.org"><b
style="color:black;background-color:#a0ffff">Augusto</b>
Vyhmeister</a></p>

</body>
</html>

Is This Answer Correct ?    20 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How are tag positions used in javascript?

865


how to write frame work Architecture in QTP

1871


How much time it will take to learn javascript?

854


How to update a function in javascript?

1042


How to redirect a page to another page in javascript?

923


What is the need of javascript?

912


What does ecma stand for?

801


Iam getting xml when we click on one button.Iam placing that xml in dom.Im getting that xml data in one xsl.In that xsl I want to increase the variable value which is declared in xsl. Ex: ffftt eeeeiii uuuuwww fff eeee uuuu

2061


What is event bubbling and capturing in javascript?

919


How do I find javascript?

862


What is the difference between textContent and innerText?

944


What is the difference between test () and exec () methods?

1066


What are math constants and functions using javascript?

940


Is javascript hard to learn?

839


Can I write javascript in notepad?

898