真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

javascript杭州,杭州js集團

JS怎么實現(xiàn)站內(nèi)搜索功能?

一:對文章關(guān)鍵字的搜索(數(shù)組的方法):

鄢陵ssl適用于網(wǎng)站、小程序/APP、API接口等需要進行數(shù)據(jù)傳輸應(yīng)用場景,ssl證書未來市場廣闊!成為成都創(chuàng)新互聯(lián)公司的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:13518219792(備注:SSL證書合作)期待與您的合作!

!DOCTYPE?html

html

head

meta?charset="utf-8"?/

title/title

style?type="text/css"

#search{

height:40px;width:?200px;font-size:?30px;text-align:?center;

}

#div?{

font-size:?20px;width:?600px;

}

#div?span{

color:?red;

}

/style

/head

body?

input?type="text"?name="search"?id="search"?value="饞"?onclick="this.value=''?"/

input?type="button"?name=""?id="bbtn"?value="搜索"?/

div?id="div"

p饞,在英文里找不到一個十分適當(dāng)?shù)淖帧A_馬暴君尼祿,以至于英國的亨利八世,在大宴群臣的時候,常見其撕下一根根又粗又壯的雞腿,舉起來大嚼,旁若無人,好一副饕餮相!但那不是饞。埃及廢王法魯克,據(jù)說每天早餐一口氣吃二十個荷包蛋,也不是饞,只是放肆,只是沒有吃相。對有某一種食物有所偏好,于是大量的吃,這是貪多無厭。饞,則著重在食物的質(zhì),最需要滿足的是品味。上天生人,在他嘴里安放一條舌,舌上還有無數(shù)的味蕾,教人焉得不饞?饞,基于生理的要求;也可以發(fā)展成為近于藝術(shù)的趣味。?

也許我們中國人特別饞一些。饞字從食,有聲。毚音讒,本義是狡兔,善于奔走,人為了口腹之欲,不惜多方奔走以膏饞吻,所謂“為了一張嘴,跑斷兩條腿”。/p

/div

script?type="text/javascript"

var?bbtn=document.getElementById('bbtn');

var?search=document.getElementById('search');

var?text=document.getElementsByTagName('p')[0];

var?text1=text.innerHTML;

var?arr=[];

var?str=text1;

bbtn.onclick=function(){

str=text1

arr=search.value;

str=str.split(arr).join('span'+arr+'/span');

text.innerHTML=str;

}

/script

/body

/html

二:對li表單的搜索:

!DOCTYPE?html

html

head

meta?charset="UTF-8"

title/title

style?type="text/css"

*{

padding:?0;margin:?0;

}

#content{

margin:?100px?300px;display:?block;

}

input{

height:?50px;width:?400px;font-size:?30px;line-height:?50px;

}

ul{

??

}

li{

margin:10px?0px;display:?block;

}

/style

/head

body

div?id="content"

ul

input?type=""?name=""?id=""?value=""?placeholder="請輸入城市的名稱或拼音"/

li?pname="北京"?cname="bj"北京/li

li?pname="株洲"?cname="zz"株洲/li

li?pname="上海"?cname="sh"上海/li

li?pname="長沙"?cname="cs"長沙/li

li?pname="杭州"?cname="hz"杭州/li

li?pname="天津"?cname="tj"天津/li

li?pname="西安"?cname="xa"西安/li

li?pname="成都"?cname="cd"成都/li

li?pname="武漢"?cname="wh"武漢/li

li?pname="南京"?cname="nj"南京/li

/ul

/div

script?type="text/javascript"

var?li=document.getElementsByTagName('li');

var?text=document.getElementsByTagName('input')[0];

function?search(){

var?arr=text.value;

for(var?i=0;ili.length;i++)

{

li[i].style.display="none";

if(li[i].getAttribute('pname').indexOf(arr)!=-1||li[i].getAttribute('cname').indexOf(arr)!=-1)

{

li[i].style.display="block";

}

}

}

text.oninput=function(){

search();

}

/script

/body

/html

誰知道國家選省份的javascript腳本,給個例子地址也可以。謝謝大家了!

這個是我國的各省的城市選擇網(wǎng)頁,你可以按自己的要求進行一些改動.

html

head

meta http-equiv="Content-Type" content="text/html; charset=UTF-8"

title省份選城市/title

style type="text/css"

!--

form{margin:0;padding:0;}

img{border:0;}

body,select,input,td{ font-family:宋體,Arial; font-size: 12px; font-family: Arial; margin-top: 2px;}

#hd{clear:both;width:700px;margin:0 auto;margin-bottom:.5em;padding:.5em 0 0 0;}

.rlcon a{text-decoration:none;margin-left:.3em;}

.mcon,.lpanel,.panel{text-align:left;}

.lg{float:left;width:185px;padding:.5em 0;}

.rl{float:right;width:100%;margin:0 0 0 -30em;}

.rlcon{text-align:right;height:32px;margin:0 0 0 190px;color:#b8b8b8;border-bottom:1px solid #b5b5b5;overflow:hidden;line-height:45px;}

#lcon{float:left;width:180px;}

#mcon{float:right;width:100%;margin:0 0 0 -20em;}

.mcon{margin:0 0 0 190px;width:570px;}

.xb{border-top:1px solid transparent !important;border-top:0;clear:both;}

#footer {margin:0 auto;width:740px;text-align:center;font-size:12px;height:30px;line-height:30px;border-top:1px solid #666;}

table{clear:both;text-align:left;}

#tip{clear:both;margin:0 auto;width:500px;background-color:#ffffe1;border:1px solid #ACA899;padding:1em;margin:1em;text-align:left;color:#ff0000;}

#tip #cancel{float:right;}

#tip ul{display:block;margin:0;padding:0;list-style-type:none;}

#tip ul li{float:left;width:220px;line-height:1.5em;background-color:#ffffe1;}

#hidenbox{border-top:1px solid transparent !important;border-top:0;clear:both;}

.bnt14{font-size:13px;font-family:宋體,Arial;line-height:18px;height:25px;}

--

/style

/head

html

body

center

form name="personalorder" action="preferences" method="POST"

div id="hd"

TABLE height=20 cellSpacing=0 cellPadding=0 width=714 align=center

border=0

TBODY

TR

TD height="60" vAlign=center DIV class=s5 align=center選擇省市:

select name="prov" onchange="setInd(this)"

option value=0不預(yù)定/optionoption value=8610北京/optionoption value=8621上海/optionoption value=8622天津/optionoption value=8623重慶/optionoption value=86311河北/optionoption value=8625江蘇/optionoption value=86571浙江/optionoption value=8620廣東/optionoption value=86351山西/optionoption value=8624遼寧/optionoption value=86431吉林/optionoption value=86451黑龍江/optionoption value=86551安徽/optionoption value=86591福建/optionoption value=86791江西/optionoption value=86531山東/optionoption value=86371河南/optionoption value=8627湖北/optionoption value=86731 selected湖南/optionoption value=8628四川/optionoption value=86851貴州/optionoption value=86871云南/optionoption value=8629陜西/optionoption value=86931甘肅/optionoption value=86971青海/optionoption value=86471內(nèi)蒙古/optionoption value=86771廣西/optionoption value=86898海南/optionoption value=86891西藏/optionoption value=86951寧夏/optionoption value=86991新疆/optionoption value=88610臺灣/optionoption value=85210香港/optionoption value=85310澳門/option/SELECT

選擇城市:

SELECT name=locid

OPTION value=86731731長沙/OPTIONOPTION value=86731730岳陽/OPTIONOPTION value=86731732湘潭/OPTIONOPTION value=86731733株洲/OPTIONOPTION value=86731734衡陽/OPTIONOPTION value=86731735郴州/OPTIONOPTION value=86731736常德/OPTIONOPTION value=86731737益陽/OPTIONOPTION value=86731738婁底/OPTIONOPTION value=86731739邵陽/OPTIONOPTION value=86731743 selected吉首/OPTIONOPTION value=86731745懷化/OPTIONOPTION value=86731746永州/OPTION

/SELECT

/DIV

script

function cls_inpt(){

var _inpt=document.getElementsByTagName("input");

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

if(_inpt[i].name.indexOf('stockid')=0 ||_inpt[i].name.indexOf('showname')=0 ||_inpt[i].name.indexOf('stockname')=0){

_inpt[i].value='';

}

}

return false;

}

cityarray0 = new Array(

"0;不預(yù)定");

cityarray8610 = new Array(

"861010;北京");

cityarray8621 = new Array(

"862121;上海");

cityarray8622 = new Array(

"862222;天津");

cityarray8623 = new Array(

"862323;重慶",

"86232314;萬州",

"8623810;涪陵");

cityarray86311 = new Array(

"86311311;石家莊",

"86311310;邯鄲",

"86311312;保定",

"86311313;張家口",

"86311314;承德",

"86311315;唐山",

"86311316;廊坊",

"86311317;滄州",

"86311318;衡水",

"86311319;邢臺",

"86311335;秦皇島");

cityarray8625 = new Array(

"862525;南京",

"8625510;無錫",

"8625511;鎮(zhèn)江",

"8625512;蘇州",

"8625513;南通",

"8625514;揚州",

"8625515;鹽城",

"8625516;徐州",

"8625517;淮安",

"862551701;淮陰",

"8625518;連云港",

"8625519;常州",

"8625523;泰州",

"8625527;宿遷");

cityarray86571 = new Array(

"86571571;杭州",

"86571570;衢州",

"86571572;湖州",

"86571573;嘉興",

"86571574;寧波",

"86571575;紹興",

"86571576;臺州",

"86571577;溫州",

"86571578;麗水",

"86571579;金華",

"86571580;舟山");

cityarray8620 = new Array(

"862020;廣州",

"8620660;汕尾",

"8620662;陽江",

"8620663;揭陽",

"8620668;茂名",

"8620750;江門",

"8620751;韶關(guān)",

"8620752;惠州",

"8620753;梅州",

"8620754;汕頭",

"8620755;深圳",

"8620756;珠海",

"8620757;佛山",

"8620758;肇慶",

"8620759;湛江",

"8620760;中山",

"8620762;河源",

"8620763;清遠(yuǎn)",

"8620766;云浮",

"8620768;潮州",

"8620769;東莞");

cityarray86351 = new Array(

"86351351;太原",

"86351349;朔州",

"86351350;忻州",

"86351352;大同",

"86351353;陽泉",

"86351354;榆次",

"86351355;長治",

"86351356;晉城",

"86351357;臨汾",

"86351358;呂梁",

"86351359;運城");

cityarray8624 = new Array(

"862424;沈陽",

"8624410;鐵嶺",

"8624411;大連",

"8624412;鞍山",

"8624413;撫順",

"8624414;本溪",

"8624415;丹東",

"8624416;錦州",

"8624417;營口",

"8624418;阜新",

"1378819;遼陽",

"8624421;朝陽",

"8624427;盤錦",

"8624429;葫蘆島");

cityarray86431 = new Array(

"86431431;長春",

"86431432;吉林",

"86431434;四平",

"86431435;通化",

"86431436;白城",

"86431437;遼源",

"86431438;松原",

"86431439;白山");

cityarray86451 = new Array(

"86451451;哈爾濱",

"86451452;齊齊哈爾",

"86451453;牡丹江",

"86451454;佳木斯",

"86451455;綏化",

"86451456;黑河",

"86451458;伊春",

"86451459;大慶",

"86451464;七臺河",

"86451467;雞西",

"86451468;鶴崗",

"86451469;雙鴨山",

"86451470;大興安嶺");

cityarray86551 = new Array(

"86551551;合肥",

"86551550;滁州",

"86551552;蚌埠",

"86551553;蕪湖",

"86551554;淮南",

"86551555;馬鞍山",

"86551556;安慶",

"86551557;宿州",

"86551558;阜陽",

"8655155801;亳州",

"86551559;黃山",

"86551561;淮北",

"86551562;銅陵",

"86551563;宣城",

"86551564;六安",

"86551565;巢湖",

"86551566;池州");

cityarray86591 = new Array(

"86591591;福州",

"86591592;廈門",

"86591593;寧德",

"86591594;莆田",

"86591595;泉州",

"86591596;漳州",

"86591597;龍巖",

"86591598;三明",

"86591599;南平");

cityarray86791 = new Array(

"86791791;南昌",

"86791701;鷹潭",

"86791790;新余",

"86791792;九江",

"86791793;上饒",

"86791794;撫州",

"86791795;宜春",

"86791796;吉安",

"86791797;贛州",

"86791798;景德鎮(zhèn)",

"86791799;萍鄉(xiāng)");

cityarray86531 = new Array(

"86531531;濟南",

"86531530;菏澤",

"86531532;青島",

"86531533;淄博",

"86531534;德州",

"86531535;煙臺",

"86531536;濰坊",

"86531537;濟寧",

"86531539;臨沂",

"86531543;濱州",

"86531546;東營",

"86531631;威海",

"86531632;棗莊",

"86531633;日照",

"86531634;萊蕪",

"86531635;聊城");

cityarray86371 = new Array(

"86371371;鄭州",

"86371370;商丘",

"86371372;安陽",

"86371373;新鄉(xiāng)",

"86371374;許昌",

"86371375;平頂山",

"86371376;信陽",

"86371377;南陽",

"86371378;開封",

"86371379;洛陽",

"86371391;焦作",

"86371392;鶴壁",

"86371393;濮陽",

"86371394;周口",

"86371395;漯河",

"86371396;駐馬店",

"86371398;三門峽");

cityarray8627 = new Array(

"862727;武漢",

"8627710;襄樊",

"8627711;鄂州",

"8627712;孝感",

"8627713;黃岡",

"8627714;黃石",

"8627715;咸寧",

"8627716;荊州",

"8627717;宜昌",

"8627718;恩施",

"8627719;十堰",

"8627722;隨州",

"8627724;荊門");

cityarray86731 = new Array(

"86731731;長沙",

"86731730;岳陽",

"86731732;湘潭",

"86731733;株洲",

"86731734;衡陽",

"86731735;郴州",

"86731736;常德",

"86731737;益陽",

"86731738;婁底",

"86731739;邵陽",

"86731743;吉首",

"86731745;懷化",

"86731746;永州");

cityarray8628 = new Array(

"862828;成都",

"8628812;攀枝花",

"8628813;自貢",

"8628816;綿陽",

"8628817;南充",

"8628818;達州",

"8628825;遂寧",

"8628826;廣安",

"8628827;巴中",

"8628830;瀘州",

"8628831;宜賓",

"8628832;資陽",

"862883201;內(nèi)江",

"8628833;樂山",

"862883301;眉山",

"862883401;涼山",

"8628835;雅安",

"862883701;阿壩",

"8628838;德陽",

"8628839;廣元");

cityarray86851 = new Array(

"86851851;貴陽",

"86851852;遵義",

"86851853;安順",

"86851854;都勻",

"86851855;凱里",

"86851856;銅仁",

"86851857;畢節(jié)",

"86851858;六盤水",

"86851859;興義");

cityarray86871 = new Array(

"86871871;昆明",

"86871691;西雙版納",

"86871692;德宏",

"86871870;昭通",

"86871872;大理",

"8687187303;紅河",

"86871874;曲靖",

"86871875;保山",

"86871876;文山",

"86871877;玉溪",

"86871878;楚雄",

"86871879;思茅",

"86871883;臨滄",

"8687188601;怒江",

"8687188701;迪慶",

"86871888;麗江");

cityarray8629 = new Array(

"862929;西安",

"8629910;咸陽",

"8629911;延安",

"8629912;榆林",

"8629913;渭南",

"8629914;商洛",

"8629915;安康",

"8629916;漢中",

"8629917;寶雞",

"8629919;銅川");

cityarray86931 = new Array(

"86931931;蘭州",

"86931930;臨夏",

"86931932;定西",

"86931933;平?jīng)?,

"86931934;慶陽",

"86931935;金昌",

"8693193501;武威",

"86931936;張掖",

"86931937;酒泉",

"8693193701;嘉峪關(guān)",

"86931938;天水",

"86931939;隴南",

"86931941;甘南",

"86931943;白銀");

cityarray86971 = new Array(

"86971971;西寧",

"8697197001;海北",

"86971972;海東",

"8697197501;果洛",

"8697197301;黃南",

"86971976;玉樹",

"86971979;格爾木",

"8697197901;海西");

cityarray86471 = new Array(

"86471471;呼和浩特",

"86471470;海拉爾",

"86471472;包頭",

"86471473;烏海",

"86471474;集寧",

"86471475;通遼",

"86471476;赤峰",

"86471478;臨河",

"86471479;錫林浩特",

"86471482;烏蘭浩特",

"86471483;巴彥浩特",

"86471484;鄂爾多斯");

cityarray86771 = new Array(

"86771771;南寧",

"86771770;防城港",

"8677177101;崇左",

"86771772;柳州",

"8677177201;來賓",

"86771773;桂林",

"86771774;梧州",

"8677177401;賀州",

"86771775;玉林",

"8677177501;貴港",

"86771776,;百色",

"86771777,;欽州",

"86771778,;河池",

"86771779,;北海");

cityarray86898 = new Array(

"86898898;海口",

"86898899;三亞",

"8689889901;西沙群島");

cityarray86891 = new Array(

"86891891;拉薩",

"86891892;日喀則",

"86891893;山南",

"86891894;林芝",

"86891895;昌都",

"86891896;那曲",

"86891897;阿里");

cityarray86951 = new Array(

"86951951;銀川",

"86951952;石嘴山",

"86951953;吳忠",

"86951954;固原");

cityarray86991 = new Array(

"86991991;烏魯木齊",

"86991901;塔城",

"86991902;哈密",

"86991903;和田",

"86991906;阿勒泰",

"8699190801;克州",

"86991909;博樂",

"86991990;克拉瑪依",

"86991993;石河子",

"86991994;昌吉",

"86991995;吐魯番",

"86991996;庫爾勒",

"86991997;阿克蘇",

"86991998;喀什",

"86991999;伊犁");

cityarray88610 = new Array(

"8861010;臺北");

cityarray85210 = new Array(

"8521010;香港");

cityarray85310 = new Array(

"8531010;澳門");

function getCitiesFromProvinceID(provinceid) {

if (provinceid == 0) return cityarray0;

if (provinceid == 8610) return cityarray8610;

if (provinceid == 8621) return cityarray8621;

if (provinceid == 8622) return cityarray8622;

if (provinceid == 8623) return cityarray8623;

if (provinceid == 86311) return cityarray86311;

if (provinceid == 8625) return cityarray8625;

if (provinceid == 86571) return cityarray86571;

if (provinceid == 8620) return cityarray8620;

if (provinceid == 86351) return cityarray86351;

if (provinceid == 8624) return cityarray8624;

if (provinceid == 86431) return cityarray86431;

if (provinceid == 86451) return cityarray86451;

if (provinceid == 86551) return cityarray86551;

if (provinceid == 86591) return cityarray86591;

if (provinceid == 86791) return cityarray86791;

if (provinceid == 86531) return cityarray86531;

if (provinceid == 86371) return cityarray86371;

if (provinceid == 8627) return cityarray8627;

if (provinceid == 86731) return cityarray86731;

if (provinceid == 8628) return cityarray8628;

if (provinceid == 86851) return cityarray86851;

if (provinceid == 86871) return cityarray86871;

if (provinceid == 8629) return cityarray8629;

if (provinceid == 86931) return cityarray86931;

if (provinceid == 86971) return cityarray86971;

if (provinceid == 86471) return cityarray86471;

if (provinceid == 86771) return cityarray86771;

if (provinceid == 86898) return cityarray86898;

if (provinceid == 86891) return cityarray86891;

if (provinceid == 86951) return cityarray86951;

if (provinceid == 86991) return cityarray86991;

if (provinceid == 88610) return cityarray88610;

if (provinceid == 85210) return cityarray85210;

if (provinceid == 85310) return cityarray85310;

return new Array();

}

function fillInCities(provinceid) {

document.forms['personalorder']['locid'].length = 0;

var arr = getCitiesFromProvinceID(provinceid);

var cnt = 0;

var isSelected = false;

for(var n=0; narr.length; n++){

newOpt=new Option;

i = arr[n].search(';');

newOpt.text=arr[n].slice(i+1);

newOpt.value=arr[n].slice(0,i);

if (!isSelected){

//newOpt.selected = true;

isSelected = true;

}

document.forms['personalorder']['locid'].options[cnt]=newOpt;

cnt=cnt+1;

}

}

function GetSelectedText(box){

var boxText = '';

for(var i=0; ibox.options.length; i++){

if(box.options[i].selected box.options[i].value != ''){

boxText = box.options[i].value;

}

}

return boxText;

}

function setInd(box) {

ind = GetSelectedText(box);

if(ind != ''){

fillInCities(ind);

}

//alert(ind);

}

/script

/TD

/TR

/TBODY

/TABLE

/body

/html

js地址添加怎么添加

//做web程序的朋友,如果你夠懶惰,請加QQ375241242,大家交流自己工作中積累的代碼集。

Province = new Array;

City = new Array;

I=0;

Province[I] = '北京';

City[I] = new Array('北京');

I++;

Province[I] = '上海';

City[I] = new Array('上海');

I++;

Province[I] = '天津';

City[I] = new Array('天津');

I++;

Province[I] = '重慶';

City[I] = new Array('重慶');

I++;

Province[I] = '河北';

City[I] = new Array("請選擇","石家莊","唐山","秦皇島","邯鄲","邢臺","保定","張家口","承德","滄州","廊坊","衡水","其他");

I++;

Province[I] = '山西';

City[I] = new Array("請選擇","太原","大同","陽泉","長治","晉城","朔州","晉中","運城","忻州","臨汾","呂梁");

I++;

Province[I] = '內(nèi)蒙古';

City[I] = new Array("請選擇","呼和浩特","包頭","烏海","赤峰","通遼","鄂爾多斯","呼倫貝爾","烏蘭察布盟","錫林郭勒盟","巴彥淖爾盟","阿拉善盟","興安盟");

I++;

Province[I] = '遼寧';

City[I] = new Array("請選擇","沈陽","大連","鞍山","撫順","本溪","丹東","錦州","葫蘆島","營口","盤錦","阜新","遼陽","鐵嶺","朝陽");

I++;

Province[I] = '吉林';

City[I] = new Array("請選擇","長春","吉林市","四平","遼源","通化","白山","松原","白城","延邊朝鮮族自治州");

I++;

Province[I] = '黑龍江';

City[I] = new Array("請選擇","哈爾濱","齊齊哈爾","鶴崗","雙鴨山","雞西","大慶","伊春","牡丹江","佳木斯","七臺河","黑河","綏化","大興安嶺");

I++;

Province[I] = '江蘇';

City[I] = new Array("請選擇","南京","無錫","徐州","常州","蘇州","南通","連云港","淮安","鹽城","揚州","鎮(zhèn)江","泰州","宿遷");

I++;

Province[I] = '浙江';

City[I] = new Array("請選擇","杭州","寧波","溫州","嘉興","湖州","紹興","金華","衢州舟山","臺州","麗水");

I++;

Province[I] = '安徽';

City[I] = new Array("請選擇","合肥","蕪湖","蚌埠","淮南","馬鞍山","淮北","銅陵","安慶","黃山","滁州","阜陽","宿州","巢湖","六安","亳州","池州","宣城");

I++;

Province[I] = '福建';

City[I] = new Array("請選擇","福州","廈門","莆田","三明","泉州","漳州","南平","龍巖","寧德");

I++;

Province[I] = '江西';

City[I] = new Array("請選擇","南昌","景德鎮(zhèn)","萍鄉(xiāng)","新余","九江","鷹潭","贛州","吉安","宜春","撫州","上饒");

I++;

Province[I] = '山東';

City[I] = new Array("請選擇","濟南","青島","淄博","棗莊","東營","濰坊","煙臺","威海","濟寧","泰安","日照","萊蕪","德州","臨沂","聊城","濱州","菏澤");

I++;

Province[I] = '河南';

City[I] = new Array("請選擇","鄭州","開封","洛陽","平頂山","焦作","鶴壁","新鄉(xiāng)","安陽","濮陽","許昌","漯河","三門峽","南陽","商丘","信陽","周口","駐馬店","濟源");

I++;

Province[I] = '湖北';

City[I] = new Array("請選擇","武漢","黃石","襄樊","十堰","荊州","宜昌","荊門","鄂州","孝感","黃岡","咸寧","隨州","仙桃","天門","潛江","神農(nóng)架","恩施土家族苗族自治州");

I++;

Province[I] = '湖南';

City[I] = new Array("請選擇","長沙","株洲","湘潭","衡陽","邵陽","岳陽","常德","張家界","益陽","郴州","懷化","婁底","湘西土家族苗族自治州");

I++;

Province[I] = '廣東';

City[I] = new Array("請選擇","廣州","深圳","珠海","汕頭","韶關(guān)","佛山","江門","湛江","茂名","肇慶","惠州","梅州","汕尾","河源","陽江","清遠(yuǎn)","東莞","中山","潮州","揭陽","云浮");

I++;

Province[I] = '廣西';

City[I] = new Array("請選擇","南寧","柳州","桂林","梧州","北海","防城港","欽州","貴港","玉林","百色","賀州","河池","來賓","崇左");

I++;

Province[I] = '海南';

City[I] = new Array("請選擇","???,"三亞","五指山","瓊海","儋州","文昌","萬寧","東方","澄邁","定安","屯昌","臨高","白沙黎族自治縣昌","江黎族自治縣","樂東黎族自治縣","陵水黎族自治縣","保亭黎族苗族自治縣","瓊中黎族苗族自治縣");

I++;

Province[I] = '四川';

City[I] = new Array("請選擇","成都","自貢","攀枝花","瀘州","德陽","綿陽","廣元","遂寧","內(nèi)江","樂山","南充","宜賓","廣安","達州","眉山","雅安","巴中","資陽","阿壩藏族羌族自治州","甘孜藏族自治州","涼山彝族自治州");

I++;

Province[I] = '貴州';

City[I] = new Array("請選擇","貴陽","六盤水","遵義","安順","銅仁","畢節(jié)","黔西南布依族苗族自治州","黔東南苗族侗族自治州","黔南布依族苗族自治州");

I++;

Province[I] = '云南';

City[I] = new Array("請選擇","昆明","曲靖","玉溪","保山","昭通","麗江","思茅","臨滄","文山壯族苗族自治州","紅河哈尼族彝族自治州","西雙版納傣族自治州","楚雄彝族自治州","大理白族自治州","德宏傣族景頗族自治州 ","怒江傈傈族自治州","迪慶藏族自治州");

I++;

Province[I] = '西藏';

City[I] = new Array("請選擇","拉薩","那曲","昌都","山南","日喀則","阿里","林芝");

I++;

Province[I] = '陜西';

City[I] = new Array("請選擇","西安","銅川","寶雞","咸陽","渭南","延安","漢中","榆林","安康","商洛");

I++;

Province[I] = '甘肅';

City[I] = new Array("請選擇","蘭州","金昌","白銀","天水","嘉峪關(guān)","武威","張掖","平?jīng)?,"酒泉","慶陽","定西","隴南","臨夏回族自治州","甘南藏族自治州");

I++;

Province[I] = '青海';

City[I] = new Array("請選擇","西寧","海東","海北藏族自治州","黃南藏族自治州","海南藏族自治州","果洛藏族自治州","玉樹藏族自治州","海西蒙古族藏族自治州");

I++;

Province[I] = '寧夏';

City[I] = new Array("請選擇","銀川","石嘴山","吳忠","固原");

I++;

Province[I] = '新疆';

City[I] = new Array("請選擇","烏魯木齊","克拉瑪依","石河子","阿拉爾","圖木舒克","五家渠","吐魯番","哈密","和田","阿克蘇","喀什","克孜勒蘇柯爾克孜自治州","巴音郭楞蒙古自治州","昌吉回族自治州","博爾塔拉蒙古自治州","伊犁哈薩克自治州");

I++;

Province[I] = '香港';

City[I] = new Array("香港");

I++;

Province[I] = '澳門';

City[I] = new Array("澳門");

I++;

Province[I] = '臺灣';

City[I] = new Array("請選擇","臺北","高雄","基隆","臺中","臺南","新竹","嘉義","臺北縣","宜蘭縣","新竹縣","桃園縣","苗栗縣","臺中縣","彰化縣","南投縣","嘉義縣","云林縣","臺南縣","高雄縣","屏東縣","臺東縣","花蓮縣","澎湖縣");

//--要使本代碼使用于不同的form,只須改變以下兩個函數(shù)在FORM里的元素的name值--

function SelectLoc()

{

pbox=document.creator.Province;//該行需改變;provinceBox=document.formName.itemName

cbox=document.creator.citys;//該行需改變;cityBox=document.formName.itemName

val=pbox.value;

if (val!=-1)

{

m=sel(val,Province);

clear(cbox);

for (i=0;iCity[m].length;i++){

fullup(cbox,City[m][i]);

}

}

else

{

clear(cbox);

}

}

function SelectProvice()

{

SelectLoc();

var locbox = document.creator.citys;//該行需改變

if(locbox.length==0) fullup(locbox, '--請選擇--');

}

//--以下函數(shù)無須改變?nèi)魏蔚胤?-

function clear(obj1)

{

len=obj1.length;

for(i=len-1;i=0;i--)

{

obj1.options[i]=null;

}

}

function fullup_P(obj1,val1,val2)

{

var vn = new Option(val1,val2);

obj1.add(vn);

}

function fullup(obj1,val)

{

var vn = new Option(val,val);

obj1.add(vn);

}

function sel(val,obj1)

{

for(i=0;iobj1.length;i++)

{

if(obj1[i]==val)

{

return i;

}

}

if (i==obj1.length){

return 0;

}

}

function write_option(val)

{

document.write("option value="+val+""+val+"/option");

}

function selBox(obj)

{

for(I=0;Iobj.length;I++)

{

write_option(obj[I]);

}

}

function selBoxi(obj)

{

for(I=0;Iobj.length;I++)

{

document.write("option value="+(I+1)+""+obj[I]+"/option");

}

}

用JS實現(xiàn)省市下拉框怎么做?

試試這個:

script language="JavaScript"

!--

var g_selProvince;

var g_selCity;

var Provinces=new Array(

new Array("110000","北京市"),

new Array("120000","天津市"),

new Array("130000","河北省"),

new Array("140000","山西省"),

new Array("150000","內(nèi)蒙古自治區(qū)"),

new Array("210000","遼寧省"),

new Array("220000","吉林省"),

new Array("230000","黑龍江省"),

new Array("310000","上海市"),

new Array("320000","江蘇省"),

new Array("330000","浙江省"),

new Array("340000","安徽省"),

new Array("350000","福建省"),

new Array("360000","江西省"),

new Array("370000","山東省"),

new Array("410000","河南省"),

new Array("420000","湖北省"),

new Array("430000","湖南省"),

new Array("440000","廣東省"),

new Array("450000","廣西壯族自治區(qū)"),

new Array("460000","海南省"),

new Array("500000","重慶市"),

new Array("510000","四川省"),

new Array("520000","貴州省"),

new Array("530000","云南省"),

new Array("540000","西藏自治區(qū)"),

new Array("610000","陜西省"),

new Array("620000","甘肅省"),

new Array("630000","青海省"),

new Array("640000","寧夏回族自治區(qū)"),

new Array("650000","新疆維吾爾自治區(qū)"),

new Array("710000","臺灣省"),

new Array("810000","香港特別行政區(qū)"),

new Array("820000","澳門特別行政區(qū)")

);

var Citys=new Array(

new Array("110100","北京"),

new Array("120100","天津"),

new Array("130101","石家莊"),

new Array("130201","唐山"),

new Array("130301","秦皇島"),

new Array("130701","張家口"),

new Array("130801","承德"),

new Array("131001","廊坊"),

new Array("130401","邯鄲"),

new Array("130501","邢臺"),

new Array("130601","保定"),

new Array("130901","滄州"),

new Array("133001","衡水"),

new Array("140101","太原"),

new Array("140201","大同"),

new Array("140301","陽泉"),

new Array("140501","晉城"),

new Array("140601","朔州"),

new Array("142201","忻州"),

new Array("142331","離石"),

new Array("142401","榆次"),

new Array("142601","臨汾"),

new Array("142701","運城"),

new Array("140401","長治"),

new Array("150101","呼和浩特"),

new Array("150201","包頭"),

new Array("150301","烏海"),

new Array("152601","集寧"),

new Array("152701","東勝"),

new Array("152801","臨河"),

new Array("152921","阿拉善左旗"),

new Array("150401","赤峰"),

new Array("152301","通遼"),

new Array("152502","錫林浩特"),

new Array("152101","海拉爾"),

new Array("152201","烏蘭浩特"),

new Array("210101","沈陽"),

new Array("210201","大連"),

new Array("210301","鞍山"),

new Array("210401","撫順"),

new Array("210501","本溪"),

new Array("210701","錦州"),

new Array("210801","營口"),

new Array("210901","阜新"),

new Array("211101","盤錦"),

new Array("211201","鐵嶺"),

new Array("211301","朝陽"),

new Array("211401","錦西"),

new Array("210601","丹東"),

new Array("220101","長春"),

new Array("220201","吉林"),

new Array("220301","四平"),

new Array("220401","遼源"),

new Array("220601","渾江"),

new Array("222301","白城"),

new Array("222401","延吉"),

new Array("220501","通化"),

new Array("230101","哈爾濱"),

new Array("230301","雞西"),

new Array("230401","鶴崗"),

new Array("230501","雙鴨山"),

new Array("230701","伊春"),

new Array("230801","佳木斯"),

new Array("230901","七臺河"),

new Array("231001","牡丹江"),

new Array("232301","綏化"),

new Array("230201","齊齊哈爾"),

new Array("230601","大慶"),

new Array("232601","黑河"),

new Array("232700","加格達奇"),

new Array("310100","上海"),

new Array("320101","南京"),

new Array("320201","無錫"),

new Array("320301","徐州"),

new Array("320401","常州"),

new Array("320501","蘇州"),

new Array("320600","南通"),

new Array("320701","連云港"),

new Array("320801","淮陰"),

new Array("320901","鹽城"),

new Array("321001","揚州"),

new Array("321101","鎮(zhèn)江"),

new Array("330101","杭州"),

new Array("330201","寧波"),

new Array("330301","溫州"),

new Array("330401","嘉興"),

new Array("330501","湖州"),

new Array("330601","紹興"),

new Array("330701","金華"),

new Array("330801","衢州"),

new Array("330901","舟山"),

new Array("332501","麗水"),

new Array("332602","臨海"),

new Array("340101","合肥"),

new Array("340201","蕪湖"),

new Array("340301","蚌埠"),

new Array("340401","淮南"),

new Array("340501","馬鞍山"),

new Array("340601","淮北"),

new Array("340701","銅陵"),

new Array("340801","安慶"),

new Array("341001","黃山"),

new Array("342101","阜陽"),

new Array("342201","宿州"),

new Array("342301","滁州"),

new Array("342401","六安"),

new Array("342501","宣州"),

new Array("342601","巢湖"),

new Array("342901","貴池"),

new Array("350101","福州"),

new Array("350201","廈門"),

new Array("350301","莆田"),

new Array("350401","三明"),

new Array("350501","泉州"),

new Array("350601","漳州"),

new Array("352101","南平"),

new Array("352201","寧德"),

new Array("352601","龍巖"),

new Array("360101","南昌"),

new Array("360201","景德鎮(zhèn)"),

new Array("362101","贛州"),

new Array("360301","萍鄉(xiāng)"),

new Array("360401","九江"),

new Array("360501","新余"),

new Array("360601","鷹潭"),

new Array("362201","宜春"),

new Array("362301","上饒"),

new Array("362401","吉安"),

new Array("362502","臨川"),

new Array("370101","濟南"),

new Array("370201","青島"),

new Array("370301","淄博"),

new Array("370401","棗莊"),

new Array("370501","東營"),

new Array("370601","煙臺"),

new Array("370701","濰坊"),

new Array("370801","濟寧"),

new Array("370901","泰安"),

new Array("371001","威海"),

new Array("371100","日照"),

new Array("372301","濱州"),

new Array("372401","德州"),

new Array("372501","聊城"),

new Array("372801","臨沂"),

new Array("372901","菏澤"),

new Array("410101","鄭州"),

new Array("410201","開封"),

new Array("410301","洛陽"),

new Array("410401","平頂山"),

new Array("410501","安陽"),

new Array("410601","鶴壁"),

new Array("410701","新鄉(xiāng)"),

new Array("410801","焦作"),

new Array("410901","濮陽"),

new Array("411001","許昌"),

new Array("411101","漯河"),

new Array("411201","三門峽"),

new Array("412301","商丘"),

new Array("412701","周口"),

new Array("412801","駐馬店"),

new Array("412901","南陽"),

new Array("413001","信陽"),

new Array("420101","武漢"),

new Array("420201","黃石"),

new Array("420301","十堰"),

new Array("420400","沙市"),

new Array("420501","宜昌"),

new Array("420601","襄樊"),

new Array("420701","鄂州"),

new Array("420801","荊門"),

new Array("422103","黃州"),

new Array("422201","孝感"),

new Array("422301","咸寧"),

new Array("422421","江陵"),

new Array("422801","恩施"),

new Array("430101","長沙"),

new Array("430401","衡陽"),

new Array("430501","邵陽"),

new Array("432801","郴州"),

new Array("432901","永州"),

new Array("430801","大庸"),

new Array("433001","懷化"),

new Array("433101","吉首"),

new Array("430201","株洲"),

new Array("430301","湘潭"),

new Array("430601","岳陽"),

new Array("430701","常德"),

new Array("432301","益陽"),

new Array("432501","婁底"),

new Array("440101","廣州"),

new Array("440301","深圳"),

new Array("441501","汕尾"),

new Array("441301","惠州"),

new Array("441601","河源"),

new Array("440601","佛山"),

new Array("441801","清遠(yuǎn)"),

new Array("441901","東莞"),

new Array("440401","珠海"),

new Array("440701","江門"),

new Array("441201","肇慶"),

new Array("442001","中山"),

new Array("440801","湛江"),

new Array("440901","茂名"),

new Array("440201","韶關(guān)"),

new Array("440501","汕頭"),

new Array("441401","梅州"),

new Array("441701","陽江"),

new Array("450101","南寧"),

new Array("450401","梧州"),

new Array("452501","玉林"),

new Array("450301","桂林"),

new Array("452601","百色"),

new Array("452701","河池"),

new Array("452802","欽州"),

new Array("450201","柳州"),

new Array("450501","北海"),

new Array("460100","???),

new Array("460200","三亞"),

new Array("510101","成都"),

new Array("513321","康定"),

new Array("513101","雅安"),

new Array("513229","馬爾康"),

new Array("510301","自貢"),

new Array("500100","重慶"),

new Array("512901","南充"),

new Array("510501","瀘州"),

new Array("510601","德陽"),

new Array("510701","綿陽"),

new Array("510901","遂寧"),

new Array("511001","內(nèi)江"),

new Array("511101","樂山"),

new Array("512501","宜賓"),

new Array("510801","廣元"),

new Array("513021","達縣"),

new Array("513401","西昌"),

new Array("510401","攀枝花"),

new Array("500239","黔江土家族苗族自治縣"),

new Array("520101","貴陽"),

new Array("520200","六盤水"),

new Array("522201","銅仁"),

new Array("522501","安順"),

new Array("522601","凱里"),

new Array("522701","都勻"),

new Array("522301","興義"),

new Array("522421","畢節(jié)"),

new Array("522101","遵義"),

new Array("530101","昆明"),

new Array("530201","東川"),

new Array("532201","曲靖"),

new Array("532301","楚雄"),

new Array("532401","玉溪"),

new Array("532501","個舊"),

new Array("532621","文山"),

new Array("532721","思茅"),

new Array("532101","昭通"),

new Array("532821","景洪"),

new Array("532901","大理"),

new Array("533001","保山"),

new Array("533121","潞西"),

new Array("533221","麗江納西族自治縣"),

new Array("533321","瀘水"),

new Array("533421","中甸"),

new Array("533521","臨滄"),

new Array("540101","拉薩"),

new Array("542121","昌都"),

new Array("542221","乃東"),

new Array("542301","日喀則"),

new Array("542421","那曲"),

new Array("542523","噶爾"),

new Array("542621","林芝"),

new Array("610101","西安"),

new Array("610201","銅川"),

new Array("610301","寶雞"),

new Array("610401","咸陽"),

new Array("612101","渭南"),

new Array("612301","漢中"),

new Array("612401","安康"),

new Array("612501","商州"),

new Array("612601","延安"),

new Array("612701","榆林"),

new Array("620101","蘭州"),

new Array("620401","白銀"),

new Array("620301","金昌"),

new Array("620501","天水"),

new Array("622201","張掖"),

new Array("622301","武威"),

new Array("622421","定西"),

new Array("622624","成縣"),

new Array("622701","平?jīng)?),

new Array("622801","西峰"),

new Array("622901","臨夏"),

new Array("623027","夏河"),

new Array("620201","嘉峪關(guān)"),

new Array("622102","酒泉"),

new Array("630100","西寧"),

new Array("632121","平安"),

new Array("632221","門源回族自治縣"),

new Array("632321","同仁"),

new Array("632521","共和"),

new Array("632621","瑪沁"),

new Array("632721","玉樹"),

new Array("632802","德令哈"),

new Array("640101","銀川"),

new Array("640201","石嘴山"),

new Array("642101","吳忠"),

new Array("642221","固原"),

new Array("650101","烏魯木齊"),

new Array("650201","克拉瑪依"),

new Array("652101","吐魯番"),

new Array("652201","哈密"),

new Array("652301","昌吉"),

new Array("652701","博樂"),

new Array("652801","庫爾勒"),

new Array("652901","阿克蘇"),

new Array("653001","阿圖什"),

new Array("653101","喀什"),

new Array("654101","伊寧"),

new Array("710001","臺北"),

new Array("710002","基隆"),

new Array("710020","臺南"),

new Array("710019","高雄"),

new Array("710008","臺中"),

new Array("211001","遼陽"),

new Array("653201","和田"),

new Array("542200","澤當(dāng)鎮(zhèn)"),

new Array("542600","八一鎮(zhèn)"),

new Array("820000","澳門"),

new Array("810000","香港")

);

function FillProvinces(selProvince)

{

selProvince.options[0]=new Option("請選擇","000000");

for(i=0;iProvinces.length;i++)

{

selProvince.options[i+1]=new Option(Provinces[i][1],Provinces[i][0]);

}

selProvince.options[0].selected=true;

selProvince.length=i+1;

}

function FillCitys(selCity,ProvinceCode)

{

//if the province is a direct-managed city, like Beijing, shanghai, tianjin, chongqin,hongkong, macro

//need not "請選擇選項"

if(ProvinceCode=="110000"||ProvinceCode=="120000"||ProvinceCode=="310000"

||ProvinceCode=="810000"||ProvinceCode=="820000"||ProvinceCode=="500000")

count=0;

else

{selCity.options[0]=new Option("請選擇",ProvinceCode);

count=1;}

for(i=0;iCitys.length;i++)

{

if(Citys[i][0].toString().substring(0,2)==ProvinceCode.substring(0,2))

{

selCity.options[count]=new Option(Citys[i][1],Citys[i][0]);

count=count+1;

}

}

selCity.options[0].selected=true;

selCity.length=count;

}

function Province_onchange()

{

FillCitys(g_selCity,g_selProvince.value);

}

function InitCitySelect(selProvince,selCity)

{

//alert("begin");

g_selProvince=selProvince;

g_selCity=selCity;

selProvince.onchange=Function("Province_onchange();");

FillProvinces(selProvince);

Province_onchange();

}

function InitCitySelect2(selProvince,selCity,CityCode)

{

InitCitySelect(selProvince,selCity)

for(i=0;iselProvince.length;i++)

{

if(selProvince.options[i].value.substring(0,2)==CityCode.substring(0,2))

{

selProvince.options[i].selected=true;

}

}

Province_onchange();

for(i=0;iselCity.length;i++)

{

if(selCity.options[i].value==CityCode)

{

selCity.options[i].selected=true;

}

}

}

//--

/script

form name="profile" method="post" action="where.asp"

SELECT id=province size=1 name=province

OPTION selected/OPTION

/SELECT

SELECT id=city size=1 name=city

OPTION selected/OPTION

/SELECT

SCRIPT language=javascript

InitCitySelect(document.profile.province,document.profile.city);

/SCRIPT

input type="submit"

/form

如你要提取市的數(shù)據(jù),你需要在接受請求頁面寫如下代碼:

shi=trim(request.form("city"))

就可以得到市的值了。

還有這是用Form傳遞參數(shù),而不是用QueryString傳遞。

jsp中利用javascript實現(xiàn)三級聯(lián)動

js代碼

//級聯(lián)菜單

var province = ['江西省','江蘇省','浙江省','甘肅省','江西省','江蘇省','浙江省','甘肅省'];

var city = Array(

new Array ('南昌市','贛州市','撫州市','上饒市'),

new Array('杭州市','溫州市','寧波市'),

new Array('南京市','蘇州市','昆山市','太倉市'),

new Array('蘭州市','敦煌市','蘭樓市'),

new Array ('南昌市','贛州市','撫州市','上饒市'),

new Array('杭州市','溫州市','寧波市'),

new Array('南京市','蘇州市','昆山市','太倉市'),

new Array('蘭州市','敦煌市','蘭樓市')

)

//遍歷省份

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

var opt = document.createElement('option'); //創(chuàng)建一個結(jié)點

opt.value = province[i]; //在value顯示

opt.innerHTML = opt.value; //頁面顯示

document.getElementById('big').appendChild(opt);

}

//省份值改變的時候調(diào)用函數(shù)

function show_small(){

//alert( document.getElementById('big').selectedIndex);//拿到下標(biāo)

document.getElementById('small').innerHTML="";//清空 appendChild會追加

var index = document.getElementById('big').selectedIndex;

for(var i=0;icity[index-1].length;i++){ //注意下標(biāo)

var opt = document.createElement('option');

opt.value = city[index-1][i];

opt.innerHTML = opt.value;

document.getElementById('small').appendChild(opt);

}

}

html代碼

!-- 級聯(lián)菜單--

select id="big" onchange="show_small()"

option value=""--select--/option

/select

select id="small"

option value=""--select--/option

/select

手上剛好有個二級聯(lián)動的,三級聯(lián)動的你可以自己看著加進去,希望對你有幫助


新聞名稱:javascript杭州,杭州js集團
當(dāng)前地址:http://weahome.cn/article/dseicpi.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部