第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何使用 HTML 表單 [代碼附加] 中的 GET 或 POST 從 javascript

如何使用 HTML 表單 [代碼附加] 中的 GET 或 POST 從 javascript

POPMUISE 2023-11-12 15:10:45
如何使用 GET 或 POST 檢索 CITY 值,就像可以使用 $_POST['stt'] 使用 STATE 值一樣?ps:堆棧溢出的新手,所以請(qǐng)建議更好的提問(wèn)方式:)var state_arr = new Array("Andaman & Nicobar");var s_a = new Array();s_a[0] = "";s_a[1] = " Alipur | Andaman Island | Anderson Island | Arainj-Laka-Punga | Austinabad | Bamboo Flat | Barren Island ";function print_state(state_id) {  // given the id of the <select> tag as function argument, it inserts <option> tags  var option_str = document.getElementById(state_id);  option_str.length = 0;  option_str.options[0] = new Option('Select State', '');  option_str.selectedIndex = 0;  for (var i = 0; i < state_arr.length; i++) {    option_str.options[option_str.length] = new Option(state_arr[i], state_arr[i]);  }}function print_city(city_id, city_index) {  var option_str = document.getElementById(city_id);  option_str.length = 0; // Fixed by Julian Woods  option_str.options[0] = new Option('Select City', '');  option_str.selectedIndex = 0;  var city_arr = s_a[city_index].split("|");  for (var i = 0; i < city_arr.length; i++) {    option_str.options[option_str.length] = new Option(city_arr[i], city_arr[i]);  }}print_state("sts");<form>  <select onchange="print_city('state', this.selectedIndex);" id="sts" name="stt" class="form-control" required></select>  <select id="state" class="form-control" required></select></form>
查看完整描述

1 回答

?
翻過(guò)高山走不出你

TA貢獻(xiàn)1875條經(jīng)驗(yàn) 獲得超3個(gè)贊

使用此功能,您將獲得城市和州在表單操作屬性中給出您的文件名


var state_arr = new Array("Andaman & Nicobar");


var s_a = new Array();

s_a[0] = "";

s_a[1] = " Alipur | Andaman Island | Anderson Island | Arainj-Laka-Punga | Austinabad | Bamboo Flat | Barren Island ";


function print_state(state_id) {

  // given the id of the <select> tag as function argument, it inserts <option> tags

  var option_str = document.getElementById(state_id);

  option_str.length = 0;

  option_str.options[0] = new Option('Select State', '');

  option_str.selectedIndex = 0;

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

    option_str.options[option_str.length] = new Option(state_arr[i], state_arr[i]);

  }

}


function print_city(city_id, city_index) {

  var option_str = document.getElementById(city_id);

  option_str.length = 0; // Fixed by Julian Woods

  option_str.options[0] = new Option('Select City', '');

  option_str.selectedIndex = 0;

  var city_arr = s_a[city_index].split("|");

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

    option_str.options[option_str.length] = new Option(city_arr[i], city_arr[i]);

  }

}


print_state("sts");

<form method="get" action="filename.html">

  <select onchange="print_city('state', this.selectedIndex);" id="sts" name="state" class="form-control" required></select>

  <select id="state" name="city" class="form-control" required></select>

  <input type="submit" value="submit"/>

</form>


查看完整回答
反對(duì) 回復(fù) 2023-11-12
  • 1 回答
  • 0 關(guān)注
  • 200 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)