Advertisement

07.26.2008 at 09:29AM PDT, ID: 23597851
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Syntax needed to populate an existing dropdown with array.

Asked by kerryw60 in JavaScript

Tags:

When the Country is changed, need to populate the State dropdown.  Have an existing Select and need to populate it with array based on Country selection.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>Dealer Locator</TITLE>
<META content="Evrsoft First Page" name=GENERATOR>
<LINK href="include/css/style.css" type=text/css rel=stylesheet>
<LINK href="include/css/layout.css" type=text/css rel=stylesheet>
<SCRIPT language=javascript src="include/js/config.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="include/js/querystring.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="include/js/browsercheck.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="include/js/common.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="include/js/string.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="include/js/mqcommon.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="include/js/mqutils.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="include/js/mqobjects.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="include/js/mqexec.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="include/js/mapcommon.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="include/js/datamanagerrecord.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="include/js/demo_common.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="include/js/helpers.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="include/js/demo_form.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript type=text/javascript>
 
    var US = new Array("AK","AL","AR","AZ","CA","CO","CT","DC","DE","FL","GA","HI","IA","ID","IL","IN","KA","KY","LA","MA","MD","ME","MI","MN","MO","MS","MT","NC","ND","NE","NH","NJ","NM","NV","NY","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VA","VT","WA","WI","WV","WY");
    var CA = new Array("AB","BC","MB","NB","NL","NS","NT","NU","ON","PE","QC","SK","YK");
 
 
	function onPageLoad(){
		//Set all form values to their defaults on page load
		document.getElementById("hdnLatitude").value = "";
		document.getElementById("hdnLongitude").value = "";
		document.getElementById("txtAddress").value = "";
		document.getElementById("txtCity").value = "";
		document.getElementById("txtPostalCode").value = "";
		document.getElementById("txtDistance").value = "10";
		//document.getElementById("selStateProvince").selectedIndex = 0;
		//swap("US")
		//document.getElementById("rdoUnitMi").checked = true;
		//Focus on the first input of the form on page load
		var formStart = document.getElementById("txtAddress");
		formStart.focus();
	}
	
 
    function swap(array){
        var opts = eval(array);
        var str="<SELECT name='selCountry'>";
        for (i=0; i<=opts.length-1; i++)
        {str+= "<option>" +opts[i] + "</option>";}
        str+= "</select></form>";
        //document.getElementById('states').innerHTML=str;
 
 
    }
	
	</SCRIPT>
</HEAD>
<BODY onload=onPageLoad();><!---Header--->
<form method="get" action="searchlocation.html" id="frmByLocation" onsubmit="return onFormSubmit('frmByLocation');"/>
<DIV id=maindiv>
<div id="banner">
    &nbsp;<div id="divSearchDetails" style="width: 1px; height: 8px;"></div>
</div>
        <table border="0" cellpadding="0" cellspacing="0" style="background-color: white; width: 760px;">
            <tr>
                <td colspan="4" style="height: 128px">
    </td>
            </tr>
            <tr>
                <td colspan="4">
                    <img alt="" src="images/content-wide-bg.JPG" height="148" style="padding-bottom: 0px; width: 768px"/></td>
            </tr>
            <tr>
                <td colspan="4">
      <DIV class=searchtitle style="text-align: left">
          Dealer By Location</DIV>
                    <span style="color: #ffffff">&gt;</span></td>
            </tr>
            <tr style="color: #000000">
                <td style="width: 152px; text-align: right">
                    <span style="font-size: 10pt">Address:</span></td>
                <td colspan="3">
                    <INPUT class=input id=txtAddress tabIndex=1 name=txtAddress style="width: 264px">
                    &nbsp; &nbsp; <span style="font-size: 10pt">Country:<SELECT class=input id=Select2 tabIndex=0 name=selCountry> 
			<OPTION value="US" selected="selected">United States</OPTION> 
			<OPTION value="CA">Canada</OPTION> 
			</SELECT></span></td>
            </tr>
            <tr style="color: #000000">
                <td style="width: 152px">
                    <span style="color: #ffffff">&gt;</span></td>
                <td style="width: 136px">
                </td>
                <td>
                </td>
                <td style="width: 100px">
                </td>
            </tr>
            <tr style="color: #000000">
                <td style="width: 152px; text-align: right">
                    <span style="font-size: 10pt">City:</span></td>
                <td colspan="3">
                    <INPUT class=input id=Text3 tabIndex=2 name=txtCity><span style="color: #a9a9a9"><span
                        style="color: #cccccc">*</span>
                        &nbsp; &nbsp;&nbsp; <span style="font-size: 10pt;">
                            
                            
                            <span style="color: #000000">State:<SELECT class=input id="states" tabIndex=3 name=selStateProvince style="color: #000000"> 
                                <OPTION value="" selected="selected"></OPTION>
                                </SELECT><span style="color: #a9a9a9"><span style="color: #cccccc">*</span><span style="font-size: 10pt;"><span style="color: #000000"></span>
                                    <span style="color: #000000">&nbsp; &nbsp; </span><span style="color: #000000;">Zip:<INPUT class=input id=Text1 tabIndex=4 maxLength=10 
            size=10 name=txtPostalCode style="color: #000000"><span style="color: #000000;"><span style="font-size: 10pt; color: #000000;"><span style="font-size: 10pt;"></span><span style="color: #cccccc">*</span></span></span></span></span></span></span></span></span></td>
            </tr>
            <tr style="color: #000000">
                <td style="width: 152px">
                    <span style="color: #ffffff">&gt;</span></td>
                <td style="width: 136px">
                </td>
                <td>
                    <span style="font-size: 10pt">
                                <span style="color: #000000">&nbsp;</span></span></td>
                <td style="width: 100px">
                </td>
            </tr>
            <tr style="color: #000000">
                <td style="width: 152px">
                </td>
                <td colspan="3">
                    <span style="font-size: 7pt; color: #cccccc">
                    * City &amp; State or Zip required</span><span style="font-size: 7pt;"></span></td>
            </tr>
            <tr>
                <td style="width: 152px">
                </td>
                <td colspan="2">
                    <span style="font-size: 10pt">&nbsp;<span style="font-size: 10pt;
                color: #000000"></span></span></td>
                <td style="width: 100px">
                </td>
            </tr>
            <tr>
                <td style="width: 152px">
                </td>
                <td rowspan="4" style="width: 136px">
                    &nbsp;</td>
                <td colspan="2">
                    <INPUT class=input id=Text4 tabIndex=6 maxLength=2 size=2 value=5 name=txtDistance> 
                    <INPUT id="rdoUnitMi" tabIndex=7 type=radio CHECKED="checked" value=Mi name=rdoUnit>
                    <span style="font-size: 10pt">Miles Or &nbsp;&nbsp;
                        <INPUT id=Radio2 tabIndex=8 type=radio value=Min name=rdoUnit>
                        <span style="font-size: 10pt; color: #000000">Minutes </span>
                    </span>
                </td>
            </tr>
            <tr>
                <td style="width: 152px">
                </td>
                <td>
                </td>
                <td style="width: 100px">
                </td>
            </tr>
            <tr>
                <td style="width: 152px">
                </td>
                <td>
                    <INPUT class=button tabIndex=9 type=submit value=Search name=Submit></td>
                <td style="width: 100px">
                </td>
            </tr>
            <tr>
                <td style="width: 152px">
                </td>
                <td>
                </td>
                <td style="width: 100px">
                </td>
            </tr>
            <tr>
                <td colspan="4">
        <INPUT id=hdnLatitude type=hidden name=hdnLatitude><INPUT id=hdnLongitude type=hidden name=hdnLongitude><INPUT type=hidden value=ByLocation name=hdnType></td>
            </tr>
            <tr>
                <td style="width: 152px">
                </td>
                <td style="width: 136px">
                </td>
                <td>
                </td>
                <td style="width: 100px">
                </td>
            </tr>
            <tr>
                <td style="width: 152px">
                </td>
                <td style="width: 136px">
                </td>
                <td>
                </td>
                <td style="width: 100px">
                </td>
            </tr>
        </table>
          </DIV>
</BODY>
</HTML>
[+][-]07.26.2008 at 10:02AM PDT, ID: 22095541

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: JavaScript
Tags: Java Script
Sign Up Now!
Solution Provided By: hielo
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-43 / EE_QW_2_20070628