473,388 Members | 1,286 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

please check my code

30
<script language="javascript">
function CreateProvince() {
var Primary = document.newforms.country.selectedIndex;
if ((Primary == null) || (Primary == 0)) return;
//Andaman
if (Primary == 1) {
var ProvState = new Array;
ProvState[0] = new Option("Bombooflat");
ProvState[1] = new Option("Car Nicobar");
ProvState[2] = new Option("Garacharma");
ProvState[3] = new Option("Port Blair");
ProvState[4] = new Option("Other Cities");
}
// A.pradesh
if (Primary == 2)
{
var ProvState = new Array;
ProvState[0] = new Option("Adilabad");
ProvState[1] = new Option("Anantapur");
ProvState[2] = new Option("Chittoor");
ProvState[3] = new Option("Kadapa");
ProvState[4] = new Option("EastGodavari");
ProvState[5] = new Option("Guntur");
ProvState[6] = new Option("Hyderabad");
ProvState[7] = new Option("Karimnagar");
ProvState[8] = new Option("Khammam");
ProvState[9] = new Option("Krishna");
ProvState[10] = new Option("Kurnool");
ProvState[11] = new Option("Mahbubnagar");
ProvState[12] = new Option("Medak");
ProvState[13] = new Option("Nalgonda");
ProvState[14] = new Option("Nellore");
ProvState[15] = new Option("Nizamabad");
ProvState[16] = new Option("Prakasam");

}
//Arunchal pradesh
if (Primary == 3)
{
var ProvState = new Array;
ProvState[0] = new Option(" Anjaw District ");
ProvState[1] = new Option("Changlang District ");
ProvState[2] = new Option("East Kameng ");
ProvState[3] = new Option("East Siang ");
ProvState[4] = new Option("Kurung Kumey ");
ProvState[5] = new Option("Lohit District ");
ProvState[6] = new Option("Lower Dibang Valley ");
ProvState[7] = new Option("Lower Subansiri ");
ProvState[8] = new Option("Papumpare ");
ProvState[9] = new Option("Tawang District ");
ProvState[10] = new Option("Tirap District ");
}

// Chandigarh Chhattisgarh

for (i=document.newforms.SelectProvState.options.lengt h; i>0; i--)
{
document.newforms.SelectProvState.options[i] = null;
}

for(i=0; i<ProvState.length; i++)
{
document.newforms.SelectProvState.options[i] = ProvState[i];
}

document.newforms.SelectProvState.options[0].selected = true;

}

//-->
</script>

<form id="newforms" runat="server">
Choose Country:
<select name="country" onchange="CreateProvince()">
<option value="">Choose State</option>
<option value="1">Andaman and Nicobar Islands</option>
<option value="2">Andhra Pradesh</option>
<option value="3">Arunachal Pradesh</option>
<option value="4">Assam</option>
<option value="5">Bihar</option>
<option value="6">Chandigarh</option>
<option value="7">Chhattisgarh</option>
<option value="8">Dadra & Nagar Haveli</option>
<option value="9">Daman & Diu</option>
<option value="10">Delhi</option>
<option value="11">Goa</option>
<option value="12">Gujarat</option>
<option value="13">Haryana</option>
<option value="14">Himachal Pradesh</option>
<option value="15">Jammu & Kashmir</option>
</select>
<select name="SelectProvState" id="cityval">
<option value="1">Choose District</option>
</select>
</form>
by using this code when i select state ,relavent cities will be displayed but i can't get city selected value could you please give urgent
Feb 28 '08 #1
2 923
shweta123
692 Expert 512MB
Hi,

You can make change in your code at the place where you are putting options in the City listbox.

for(i=0; i<ProvState.length; i++)
{

document.newforms.SelectProvState.options[i] = new Option(ProvState[i],ProvState[i]);

// document.newforms.SelectProvState.options[i] = ProvState[i];
}


<script language="javascript">
function CreateProvince() {
var Primary = document.newforms.country.selectedIndex;
if ((Primary == null) || (Primary == 0)) return;
//Andaman
if (Primary == 1) {
var ProvState = new Array;
ProvState[0] = new Option("Bombooflat");
ProvState[1] = new Option("Car Nicobar");
ProvState[2] = new Option("Garacharma");
ProvState[3] = new Option("Port Blair");
ProvState[4] = new Option("Other Cities");
}
// A.pradesh
if (Primary == 2)
{
var ProvState = new Array;
ProvState[0] = new Option("Adilabad");
ProvState[1] = new Option("Anantapur");
ProvState[2] = new Option("Chittoor");
ProvState[3] = new Option("Kadapa");
ProvState[4] = new Option("EastGodavari");
ProvState[5] = new Option("Guntur");
ProvState[6] = new Option("Hyderabad");
ProvState[7] = new Option("Karimnagar");
ProvState[8] = new Option("Khammam");
ProvState[9] = new Option("Krishna");
ProvState[10] = new Option("Kurnool");
ProvState[11] = new Option("Mahbubnagar");
ProvState[12] = new Option("Medak");
ProvState[13] = new Option("Nalgonda");
ProvState[14] = new Option("Nellore");
ProvState[15] = new Option("Nizamabad");
ProvState[16] = new Option("Prakasam");

}
//Arunchal pradesh
if (Primary == 3)
{
var ProvState = new Array;
ProvState[0] = new Option(" Anjaw District ");
ProvState[1] = new Option("Changlang District ");
ProvState[2] = new Option("East Kameng ");
ProvState[3] = new Option("East Siang ");
ProvState[4] = new Option("Kurung Kumey ");
ProvState[5] = new Option("Lohit District ");
ProvState[6] = new Option("Lower Dibang Valley ");
ProvState[7] = new Option("Lower Subansiri ");
ProvState[8] = new Option("Papumpare ");
ProvState[9] = new Option("Tawang District ");
ProvState[10] = new Option("Tirap District ");
}

// Chandigarh Chhattisgarh

for (i=document.newforms.SelectProvState.options.lengt h; i>0; i--)
{
document.newforms.SelectProvState.options[i] = null;
}

for(i=0; i<ProvState.length; i++)
{
document.newforms.SelectProvState.options[i] = ProvState[i];
}

document.newforms.SelectProvState.options[0].selected = true;

}

//-->
</script>

<form id="newforms" runat="server">
Choose Country:
<select name="country" onchange="CreateProvince()">
<option value="">Choose State</option>
<option value="1">Andaman and Nicobar Islands</option>
<option value="2">Andhra Pradesh</option>
<option value="3">Arunachal Pradesh</option>
<option value="4">Assam</option>
<option value="5">Bihar</option>
<option value="6">Chandigarh</option>
<option value="7">Chhattisgarh</option>
<option value="8">Dadra & Nagar Haveli</option>
<option value="9">Daman & Diu</option>
<option value="10">Delhi</option>
<option value="11">Goa</option>
<option value="12">Gujarat</option>
<option value="13">Haryana</option>
<option value="14">Himachal Pradesh</option>
<option value="15">Jammu & Kashmir</option>
</select>
<select name="SelectProvState" id="cityval">
<option value="1">Choose District</option>
</select>
</form>
by using this code when i select state ,relavent cities will be displayed but i can't get city selected value could you please give urgent
Feb 28 '08 #2
kenobewan
4,871 Expert 4TB
For JS problems, unless they have an asp.net component, please post in the JS/Ajax forum.

MODERATOR
Feb 28 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

35
by: wired | last post by:
Hi, I've just taught myself C++, so I haven't learnt much about style or the like from any single source, and I'm quite styleless as a result. But at the same time, I really want nice code and I...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
1
by: Pax S | last post by:
I need a button that will check (make true) two check boxes (fields) For the record that has the focus (the record on the form that I am presently looking at). The two check boxes would be like a...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
4
by: Gary | last post by:
Hello, I'm hoping someone can shed some light on why my report does not output the same results as shown in preview mode, which is to move the position of a check box based on a field value (see...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
1
by: icetalks | last post by:
have a look at this code , its for logging the user in after checking his UserName and Password. dim check as boolean = false ... ... If txtUserName.Text.Length = 0 And txtPass.Text.Length =...
5
kirubagari
by: kirubagari | last post by:
I want to check the arrangement of data in this order from byte 49 to mFile size(END OF FILE). 04 FF _ _ _ _ _04 FF _ _ _ _ 04 FF _ _. _ __ 04 FF _ _ _ _ 04 FF _ _ _ _ 04 FF Actually the values...
61
by: warint | last post by:
My lecturer gave us an assignment. He has a very "mature" way of teaching in that he doesn't care whether people show up, whether they do the assignments, or whether they copy other people's work....
2
by: LilMeechc20 | last post by:
Hello, I have a group assignment that I have to do. We have to write a Tic Tac Toe game. One person in my group has managed to write the code for a multiplayer (human -vs- human) game and I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.