htmlcode
I have two textFields. One TextField have all country names,if we select one country name then the related states of that countries are displayed
in another textfield dynamically.How is it possible.
pls send the code as soon as possible.
Thank you very much
View Answers
June 18, 2010 at 12:35 PM
Hi Friend,
Try the following code:
<html>
<h2>ComboBox</h2>
<script language="javascript">
var arr = new Array();
arr[0] = new Array("-select-");
arr[1] = new Array("Maharashtra","Karnataka","Andhra Pradesh","Tamil Nadu");
arr[2] = new Array("Carinthia"," Styria");
arr[3] = new Array("Florida","New York","Maryland");
arr[4] = new Array("Queensland","Victoria","Tasmania","New South Wales");
function change(combo1)
{
var comboValue = combo1.value;
document.forms["form"].elements["combo2"].options.length=0;
for (var i=0;i<arr[comboValue].length;i++)
{
var option = document.createElement("option");
option.setAttribute('value',i+1);
option.innerHTML = arr[comboValue][i];
document.forms["form"].elements["combo2"].appendChild(option);
}
}
</script>
<form name="form" method="post">
<select name="combo1" onchange="change(this);">
<option value="0">-Select-</option>
<option value="1">India</option>
<option value="2">Austria</option>
<option value="3">USA</option>
<option value="4">Australia</option>
</option>
</select><br />
<select name="combo2">
</select>
</form>
</html>
Thanks
Related Tutorials/Questions & Answers:
htmlcode problem - Java Beginnershtmlcode problem My Question :
If I want to Create one button in html,then pressed that button one textbox is displayed dynamically .
what is the code for this.Is it possible in html.
pls send answer anyone as son
htmlcode problem - Java Beginnershtmlcode problem If I press html button at that time one textbox is displayed, it is done only for 4 times otherwise it will be ristricted to display textbox
pls send me code for this
Thank you for this help
Hi
Advertisements
jsp - JDBCjsp how to link jsp code with next
htmlcode. Hi keerthi,
Can u explain ur question clearly? What is your exact Requirement