 |
|
อยากให้โค้ดนี้เชื่องฃมต่อกับ access อะค่ะ ต้องเปลี่ยนตรงไหน
ให้ access มีข้อมูลของ ตัวเลือกที่อยู่ใน var ทั้งหมดที่ขึ้มมาหลังจากกด select แรก
ซึ่งจะเขียนลง visual web developer 2008 ค่ะ ช่วยหน่อยนะค่ะ
Code (ASP)
001. <script language= "JavaScript" >
002.
003. <!-- Begin
004. var thaiArray = new Array( "('Select country','',true,true)" ,
005. //***ต้องการให้ตัวเลือกตรงนี้ของ var ทุกตัว มาจาก access ค่ะทำไง***
006. "('Ethiopia')" ,
007. "('Somalia')" ,
008. "('South Africa')" ,
009. "('Other')" );
010.
011. var africaArray = new Array( "('Select country','',true,true)" ,
012. "('Ethiopia')" ,
013. "('Somalia')" ,
014. "('South Africa')" ,
015. "('Other')" );
016. var middleeastArray = new Array( "('Select country','',true,true)" ,
017. "('Egypt')" ,
018. "('Iran')" ,
019. "('Israel')" ,
020. "('Kuwait')" ,
021. "('Lebanon')" ,
022. "('Morocco')" ,
023. "('Saudi Arabia')" ,
024. "('Syria')" ,
025. "('Turkey')" ,
026. "('U. A. Emirates')" ,
027. "('Other')" );
028. var asiaArray = new Array( "('Select country','',true,true)" ,
029. "('Armenia')" ,
030. "('Bangladesh')" ,
031. "('Cambodia')" ,
032. "('China')" ,
033. "('India')" ,
034. "('Indonesia')" ,
035. "('Japan')" ,
036. "('Malaysia')" ,
037. "('Myanmar')" ,
038. "('Nepal')" ,
039. "('Pakistan')" ,
040. "('Philippines')" ,
041. "('Singapore')" ,
042. "('South Korea')" ,
043. "('Sri Lanka')" ,
044. "('Taiwan')" ,
045. "('Thailand')" ,
046. "('Uzbekistan')" ,
047. "('Vietnam')" ,
048. "('Other')" );
049. var europeArray = new Array( "('Select country','',true,true)" ,
050. "('Albania')" ,
051. "('Austria')" ,
052. "('Belarus')" ,
053. "('Belgium')" ,
054. "('Bosnia')" ,
055. "('Bulgaria')" ,
056. "('Croatia')" ,
057. "('Cyprus')" ,
058. "('Czech Rep.')" ,
059. "('Denmark')" ,
060. "('Estonia')" ,
061. "('Finland')" ,
062. "('France')" ,
063. "('Germany')" ,
064. "('Greece')" ,
065. "('Hungary')" ,
066. "('Iceland')" ,
067. "('Ireland')" ,
068. "('Italy')" ,
069. "('Latvia')" ,
070. "('Liechtenstein')" ,
071. "('Lithuania')" ,
072. "('Luxembourg')" ,
073. "('Macedonia')" ,
074. "('Malta')" ,
075. "('Monaco')" ,
076. "('Netherlands')" ,
077. "('Norway')" ,
078. "('Poland')" ,
079. "('Portugal')" ,
080. "('Romania')" ,
081. "('Russia')" ,
082. "('Slovakia')" ,
083. "('Slovenia')" ,
084. "('Spain')" ,
085. "('Sweden')" ,
086. "('Switzerland')" ,
087. "('Ukraine')" ,
088. "('United Kingdom')" ,
089. "('Other')" );
090. var australiaArray = new Array( "('Select country','',true,true)" ,
091. "('Australia')" ,
092. "('New Zealand')" ,
093. "('Other')" );
094. var lamericaArray = new Array( "('Select country','',true,true)" ,
095. "('Costa Rica')" ,
096. "('Cuba')" ,
097. "('El Salvador')" ,
098. "('Guatemala')" ,
099. "('Haiti')" ,
100. "('Jamaica')" ,
101. "('Mexico')" ,
102. "('Panama')" ,
103. "('Other')" );
104. var namericaArray = new Array( "('Select country','',true,true)" ,
105. "('Canada')" ,
106. "('USA')" ,
107. "('Other')" );
108. var samericaArray = new Array( "('Select country','',true,true)" ,
109. "('Argentina')" ,
110. "('Bolivia')" ,
111. "('Brazil')" ,
112. "('Chile')" ,
113. "('Colombia')" ,
114. "('Ecuador')" ,
115. "('Paraguay')" ,
116. "('Peru')" ,
117. "('Suriname')" ,
118. "('Uruguay')" ,
119. "('Venezuela')" ,
120. "('Other')" );
121. function populateCountry(inForm,selected) {
122. var selectedArray = eval(selected + "Array" );
123. while (selectedArray.length < inForm.country.options.length) {
124. inForm.country.options[(inForm.country.options.length - 1)] = null;
125. }
126. for (var i=0; i < selectedArray.length; i++) {
127. eval( "inForm.country.options[i]=" + "new Option" + selectedArray[i]);
128. }
129. if (inForm.region.options[0].value ==
130. inForm.region.options[0]= null;
131. if ( navigator.appName ==
132. if (parseInt(navigator.appVersion) < 4) {
133. window.history.go(0);
134. }
135. else {
136. if (navigator.platform ==
137. window.history.go(0);
138. }
139. }
140. }
141. }
142. }
143. function populateUSstate(inForm,selected) {
144. var stateArray = new Array( "('Select State','',true,true)" ,
145. "('Alabama')" ,
146. "('Alaska')" ,
147. "('Arizona')" ,
148. "('Arkansas')" ,
149. "('California')" ,
150. "('Colorado')" ,
151. "('Connecticut')" ,
152. "('Delaware')" ,
153. "('Columbia')" ,
154. "('Florida')" ,
155. "('Georgia')" ,
156. "('Hawaii')" ,
157. "('Idaho')" ,
158. "('Illinois')" ,
159. "('Indiana')" ,
160. "('Iowa')" ,
161. "('Kansas')" ,
162. "('Kentucky')" ,
163. "('Louisiana')" ,
164. "('Maine')" ,
165. "('Maryland')" ,
166. "('Massachusetts')" ,
167. "('Michigan')" ,
168. "('Minnesota')" ,
169. "('Mississippi')" ,
170. "('Missouri')" ,
171. "('Montana')" ,
172. "('Nebraska')" ,
173. "('Nevada')" ,
174. "('New Hampshire')" ,
175. "('New Jersey')" ,
176. "('New Mexico')" ,
177. "('New York')" ,
178. "('North Carolina')" ,
179. "('North Dakota')" ,
180. "('Ohio')" ,
181. "('Oklahoma')" ,
182. "('Oregon')" ,
183. "('Pennsylvania')" ,
184. "('Rhode Island')" ,
185. "('South Carolina')" ,
186. "('South Dakota')" ,
187. "('Tennessee')" ,
188. "('Texas')" ,
189. "('Utah')" ,
190. "('Vermont')" ,
191. "('Virginia')" ,
192. "('Washington')" ,
193. "('West Virginia')" ,
194. "('Wisconsin')" ,
195. "('Wyoming')" );
196. if (selected ==
197. for (var i=0; i < stateArray.length; i++) {
198. eval( "inForm.country.options[i]=" + "new Option" + stateArray[i]);
199. }
200. if ( navigator.appName ==
201. if (parseInt(navigator.appVersion) < 4) {
202. window.history.go(0)
203. }
204. else {
205. if (navigator.platform ==
206. window.history.go(0)
207. }
208. }
209. }
210. }
211. else {
212. }
213. if (selected ==
214. newCountry = "" ;
215. while (newCountry == "" ){
216. newCountry=prompt ( "Please enter the name of your country." , "" );
217. }
218. if (newCountry != null) {
219. inForm.country.options[(inForm.country.options.length-1)]=new Option (newCountry,newCountry,true,true);
220. inForm.country.options[inForm.country.options.length]=new Option (
221. }
222. }
223. if(inForm.country.options[0].text ==
224. inForm.country.options[0]= null;
225. }
226. }
227. // End -->
228. </script>
229. <center>
230. <form name= "globe" >
231. <select name= "region" onchange= "populateCountry(document.globe,document.globe.region.options[document.globe.region.selectedIndex].value)" >
232. <option selected value=
233. <option value=
234. <option value=
235. <option value=
236. <option value=
237. <option value=
238. <option value=
239. <option value=
240. <option value=
241. <option value=
242. </select>
243. Gegraphy
244. <select id= "ddlProvince" name= "ddlGeo" onchange= "ListProvnce(this.value)" >
245. <option selected value= "" ></option>
246. <?
247.
248. ?>
249. </select>
250. <select name= "country" onchange= "populateUSstate(document.globe,document.globe.country.options[document.globe.country.selectedIndex].text)" >
251. <option value=
252. </select>
253. </form>
254. </center>
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2009-11-13 11:34:32 |
By :
byeday |
View :
1503 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |