...

View Full Version : help



marianmarian
02-25-2003, 08:13 PM
Hello all,

Below is my code, Hope you can help me. Please cut and paste my code to understand what i am trying to do.

Supposed you have seen my code, here is what i want to do:

if a person select any country aside from the US and Canada, i want to provide the person with an input text area to enter the name of their province or even say "N/A".

Hope you can help me out. again thanks for your help!

marianmarian
02-25-2003, 08:14 PM
<form name="doublecombo">
<TR>
<TD></TD>
<TD CLASS=BLACK COLSPAN=2>Country<SPAN CLASS=RED>*</SPAN></TD>
<TD CLASS=BLACK>
<select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option value="CA" selected>Canada</option>
<option value="US">United States</option>
<option value="AF">Afghanistan</option>
<option value="AL">Albania</option>
<option value="DZ">Algeria</option>
<option value="AS">American Samoa</option>
<option value="AD">Andorra</option>
<option value="AO">Angola</option>
<option value="AI">Anguilla</option>
<option value="AQ">Antarctica</option>
<option value="AG">Antigua And Barbuda</option>
<option value="AR">Argentina</option>
<option value="AM">Armenia</option>
<option value="AW">Aruba</option>
<option value="AU">Australia</option>
<option value="AT">Austria</option>
<option value="AZ">Azerbaijan</option>
<option value="BS">Bahamas</option>
<option value="BH">Bahrain</option>
</select><br>
</TD>
</TR>
<TR>
<TD></TD>
<TD CLASS=BLACK COLSPAN=2>Province/State<SPAN CLASS=RED>*</SPAN></TD>
<TD>
<select name="stage2" size="1">
<OPTION VALUE="ON" selected>Ontario</OPTION>
<OPTION VALUE="AB" >Alberta</OPTION>
<OPTION VALUE="BC" >British Columbia</OPTION>
<OPTION VALUE="MB" >Manitoba</OPTION>
<OPTION VALUE="NB" >New Brunswick</OPTION>
<OPTION VALUE="NF" >Newfoundland</OPTION>
<OPTION VALUE="NS" >Nova Scotia</OPTION>
<OPTION VALUE="NU" >Nunavut</OPTION>
<OPTION VALUE="PE" >Prince Edward Island</OPTION>
<OPTION VALUE="QC" >Quebec</OPTION>
<OPTION VALUE="SK" >Saskatchewan</OPTION>
<OPTION VALUE="NT" >Northwest Territories</OPTION>
<OPTION VALUE="YT" >Yukon Territory</OPTION>
</select>
</TD>
</TR>
<script>
//variables
var groups=document.doublecombo.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group=new Array()

//Canada provinces
group[0][0]=new Option("Ontario","ON")
group[0][1]=new Option("Alberta","AB")
group[0][2]=new Option("British Columbia","BC")
group[0][3]=new Option("Manitoba","MB")
group[0][4]=new Option("New Brunswick","NB")
group[0][5]=new Option("Newfoundland","NF")
group[0][6]=new Option("Nova Scotia","NS")
group[0][7]=new Option("Nunavut","NU")
group[0][8]=new Option("Prince Edward Island","PE")
group[0][9]=new Option("Quebec","QC")
group[0][10]=new Option("Saskatchewan","SK")
group[0][11]=new Option("Northwest Territories","NT")
group[0][12]=new Option("Yukon Territory","YT")

//US provinces
group[1][0]=new Option("Armed Forces Americas","AA")
group[1][1]=new Option("Armed Forces Europe, Middle East, & Canada","AE")
group[1][2]=new Option("Armed Forces Pacific","AP")
group[1][3]=new Option("Alaska","AK")
group[1][4]=new Option("Alabama","AL")
group[1][5]=new Option("Arkansas","AR")
group[1][6]=new Option("American Samoa","AS")
group[1][7]=new Option("Arizona","AZ")
group[1][8]=new Option("California","CA")
group[1][9]=new Option("Colorado","CO")
group[1][10]=new Option("Connecticut","CT")
group[1][11]=new Option("District of Columbia","DC")
group[1][12]=new Option("Delaware","DE")
group[1][13]=new Option("Florida","FL")
group[1][14]=new Option("Federated States of Micronesia","FM")
group[1][15]=new Option("Georgia","GA")
group[1][16]=new Option("Guam","GU")
group[1][17]=new Option("Hawaii","HI")
group[1][18]=new Option("Iowa","IA")
group[1][19]=new Option("Idaho","ID")
group[1][20]=new Option("Illinois","IL")
group[1][21]=new Option("Indiana","IN")
group[1][22]=new Option("Kansas","KS")
group[1][23]=new Option("Kentucky","KY")
group[1][24]=new Option("Louisiana","LA")
group[1][25]=new Option("Massachusetts","MA")
group[1][26]=new Option("Maryland","MD")
group[1][27]=new Option("Marshall Islands","MH")
group[1][28]=new Option("Michigan","MI")
group[1][29]=new Option("Minnesota","MN")
group[1][30]=new Option("Missouri","MO")
group[1][31]=new Option("Northern Mariana Islands","MP")
group[1][32]=new Option("Mississippi","MS")
group[1][33]=new Option("Montana","MT")
group[1][34]=new Option("North Carolina","NC")
group[1][35]=new Option("North Dakota","ND")
group[1][36]=new Option("Nebraska","NE")
group[1][37]=new Option("New Hampshire","NH")
group[1][38]=new Option("New Jersey","NJ")
group[1][39]=new Option("New Mexico","NM")
group[1][40]=new Option("Nevada","NV")
group[1][41]=new Option("New York","NY")
group[1][42]=new Option("Ohio","OH")
group[1][43]=new Option("Oklahoma","OK")
group[1][44]=new Option("Oregon","OR")
group[1][45]=new Option("Pennsylvania","PA")
group[1][46]=new Option("Puerto Rico","PR")
group[1][47]=new Option("Palau","PW")
group[1][48]=new Option("Rhode Island","RI")
group[1][49]=new Option("South Carolina","SC")
group[1][49]=new Option("South Dakota","SD")
group[1][50]=new Option("Tennessee","TN")
group[1][51]=new Option("Texas","TX")
group[1][52]=new Option("Utah","UT")
group[1][53]=new Option("Virginia","VA")
group[1][54]=new Option("Virgin Islands","VI")
group[1][55]=new Option("Vermont","VT")
group[1][56]=new Option("Washington","WA")
group[1][57]=new Option("Wisconsin","WI")
group[1][58]=new Option("Wyoming","WY")

var temp=document.doublecombo.stage2

//this function is for the countries and provinces
function redirect(x)
{
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++)
{
temp.options=new Option(group[x].text,group[x].value)
}
temp.options[0].selected=true
}

</script>

</form>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum