Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  




Share on Google+Share on Google+

1 Answer(s)      7 years ago
Posted in : Java Interview Questions
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:

<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;
for (var i=0;i<arr[comboValue].length;i++)
var option = document.createElement("option");
option.innerHTML = arr[comboValue][i];
<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>

</select><br />
<select name="combo2">



Related Tutorials/Questions & Answers:
htmlcode problem - Java Beginners
htmlcode 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 Beginners
htmlcode 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
jsp - JDBC
jsp  how to link jsp code with next htmlcode.  Hi keerthi, Can u explain ur question clearly? What is your exact Requirement