日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

html判断国家,对261个国家地区快速查找抉择

發布時間:2024/5/8 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 html判断国家,对261个国家地区快速查找抉择 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

對261個國家地區快速查找選擇

實現的效果如下

當輸入小寫字母“z”的時候,刷出所有以z開頭的國家

當輸入漢字“美”的時候,刷出以美字開頭的國家

1、使用java,SSH,Easyui

2、數據庫設計,code:國家英語簡寫,note:中文注釋,pycode:中文拼音縮寫,english:英文名稱

其中pycode全部為小寫,note為中文名稱,其余字段全部是大寫

3、html代碼

國籍:

4、js代碼

$(function(){

$('#country').combobox({//國家代碼初始化

valueField:'english',

textField:'note',

url:'json/country.json',

cache: false,

//panelHeight: 'auto',//自動高度適合

onChange: function(newValue,oldValue){

countrySearch(newValue);

}

});

});

function countrySearch(newValue){//國家信息更改

//判斷漢字 (/[\u4e00-\u9fa5]+/).test(newValue))

if((/[a-z]+/).test(newValue)||(/[\u4e00-\u9fa5]+/).test(newValue)){

$('#country').combobox({//國家代碼初始化

valueField:'english',

textField:'note',

url:'apply/countryCombobox_combobox.action?values='+encodeURI(encodeURI(newValue)),

cache: false

// panelHeight: 'auto'//自動高度適合

});

}

}

5、Action代碼

//模糊查詢國家代碼表

public String countryCombobox() throws Exception{

log.info("=====下拉框查詢國家代碼========");

values=URLDecoder.decode(values,"UTF-8");

String fields;

if(values.getBytes().length==values.length()){//如果相等 輸入的就不是漢字

log.info("pycode");

fields="pycode";

}else{//如果不相等 輸入的就是漢字

log.info("note");

fields="note";

}

List list=comboboxService.findCountry(fields, values);

this.jsonUtil(list);

return null;

}

6、接口

//查詢國家代碼表

public List findCountry(String fileds,String values) throws Exception;

7、接口實現類

//查詢國家代碼表

public List findCountry(String fields,String values) throws Exception{

Criteria criteria=this.sessionFactory.getCurrentSession().createCriteria(CcountryTbl.class);

//當屬性和值都不為空的時候,進行模糊查詢

if(StringUtils.isNotBlank(fields)&&StringUtils.isNotBlank(values)){

criteria.add(Restrictions.like(fields, values+"%"));

}

return criteria.list();

}

總結

以上是生活随笔為你收集整理的html判断国家,对261个国家地区快速查找抉择的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。