欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

jquery二級(jí)聯(lián)動(dòng),jsp二級(jí)聯(lián)動(dòng)

怎么用jquery實(shí)現(xiàn)二級(jí)聯(lián)動(dòng)

你好!

在堯都等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供成都做網(wǎng)站、成都網(wǎng)站設(shè)計(jì) 網(wǎng)站設(shè)計(jì)制作定制網(wǎng)站開發(fā),公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),高端網(wǎng)站設(shè)計(jì),成都全網(wǎng)營(yíng)銷,成都外貿(mào)網(wǎng)站建設(shè)公司,堯都網(wǎng)站建設(shè)費(fèi)用合理。

下面是個(gè)簡(jiǎn)單的小例子,僅供參考:

script?type="text/javascript"

$(document).ready(function(){

var?data={

"liaoning":{

"210100000000":"沈陽(yáng)市",

"210200000000":"大連市",

"210300000000":"鞍山市"

},

"heilongjiang":{

"230100000000":"哈爾濱市",

"230200000000":"齊齊哈爾市",

"230300000000":"雞西市"

}

};

$("#aa").change(function(){

if(this.value==0){

$("#bb").empty();

}?else?{

for(var?key?in?data){

if(key==this.value){

$("#bb").empty();

for(var?kkey?in?data[this.value]){

$("option?/").attr("value",kkey).text(data[this.value][kkey]).appendTo($("#bb"));

}

}

}

}

});

});

/script

/head

body

select?id="aa"

option?value="0"請(qǐng)選擇省/option

option?value="liaoning"遼寧/option

option?value="heilongjiang"黑龍江/option

/select

select?id="bb"

/select

/body

希望對(duì)你有幫助!

jquery如何動(dòng)態(tài)產(chǎn)生二級(jí)聯(lián)動(dòng),就是點(diǎn)擊添加按鈕后產(chǎn)生一個(gè)二級(jí)聯(lián)動(dòng)

二級(jí)聯(lián)動(dòng):

script

//點(diǎn)擊按鈕生成一級(jí)聯(lián)動(dòng)

$("button").on("click",function(){

var?oneSelect?=?"select?name='oneSelect'/select";

$("body").append(oneSelect);

});

//這里說明下,英文二級(jí)聯(lián)動(dòng)是根據(jù)一級(jí)聯(lián)動(dòng)來的,邏輯代碼看你自己了,因?yàn)?/p>

//一級(jí)聯(lián)動(dòng)是js動(dòng)態(tài)生成的,再綁定事件涉及特殊方法live,而live這個(gè)方法1.8.3

//jquery版本以后是廢棄的,所以要使用

//$("select[name=oneSelect]").on("change","父級(jí)節(jié)點(diǎn)",fucntion(){});

//根據(jù)你的一級(jí)聯(lián)動(dòng)以及需求選擇觸發(fā)二級(jí)聯(lián)動(dòng)

$("select[name=oneSelect]").live("change",function(){

var?twoSelect?=?"select?name='twoSelect'/select";

$("body").append(twoSelect);

});

/script

jQuery如何實(shí)現(xiàn)下拉框的二級(jí)聯(lián)動(dòng)?

給你一個(gè)三級(jí)聯(lián)動(dòng)的,你你參考一下

script language="JavaScript" type="text/javascript"

function createCode()

{

//數(shù)組賦值

var varname = new Array(4);

varname[0] = "請(qǐng)選擇";

varname[1] = "紅色";

varname[2] = "黃色";

varname[3] = "藍(lán)色";

//下拉框賦值

for(var i=0;i4;i++)

{

document.getElementById('xlk1').options[i] = new Option(varname[i],i);

}

copy();

}

//復(fù)制下拉框一給下拉框二

function copy()

{

for(i=0;idocument.getElementById("xlk1").options.length;i++)

{

document.getElementById('xlk2').options[i] = new Option(document.getElementById("xlk1").options[i].text,i)

}

copytwo();

}

//復(fù)制下拉框一給下拉框二

function copytwo()

{

for(i=0;idocument.getElementById("xlk2").options.length;i++)

{

document.getElementById('xlk3').options[i] = new Option(document.getElementById("xlk2").options[i].text,i)

}

}

function onChange1()

{

//獲取下拉框1的選中項(xiàng)

var strid=document.getElementById("xlk1").value;

//獲取選中項(xiàng)的內(nèi)容

//var strtxt=document.getElementById("xlk1").options[window.document.getElementById("xlk1").selectedIndex].text;

//獲取指定ID下拉框的項(xiàng)總數(shù)

//var strnub=document.getElementById("xlk1").options.length;

copy();

if(strid != 0)

{

document.getElementById("xlk2").options.remove(strid);

document.getElementById("xlk3").options.remove(strid);

}

document.getElementById("textfield").value=strid+strtxt+strnub;

}

function onChange2()

{

//獲取下拉框1的選中項(xiàng)

var strid2=document.getElementById("xlk2").selectedIndex;

//獲取選中項(xiàng)的內(nèi)容

var strtxt2=document.getElementById("xlk2").options[window.document.getElementById("xlk2").selectedIndex].text;

//獲取指定ID下拉框的項(xiàng)總數(shù)

var strnub2=document.getElementById("xlk2").options.length;

copytwo();

if(strid2 != 0)

{

document.getElementById("xlk3").options.remove(strid2);

}

}

/script

body onLoad="createCode()"

form id="form1" name="form1" method="post" action=""

select name="xlk1" id="xlk1" onChange="onChange1()"/select

select name="xlk2" id="xlk2" onChange="onChange2()"/select

select name="xlk3" id="xlk3"/select

/form

網(wǎng)站標(biāo)題:jquery二級(jí)聯(lián)動(dòng),jsp二級(jí)聯(lián)動(dòng)
文章網(wǎng)址:http://chinadenli.net/article40/dsgepho.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供自適應(yīng)網(wǎng)站服務(wù)器托管網(wǎng)站收錄小程序開發(fā)微信小程序企業(yè)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)