基於jquery的多功能軟鍵盤外掛程式

來源:互聯網
上載者:User

支援查詢功能的鍵盤和簡單得軟鍵盤,鍵盤樣式完全在獨立的css檔案中定義,可以自行美化。

(支援從查詢的軟鍵盤)

(簡單的軟體盤)

外掛程式的預設參數
複製代碼 代碼如下:
jquery.fn.softkeyboard.defaults = {
names: {
_delbtn: "skbdel",
_clearbtn: "skbclear",
_querybtn: "skbquery",
_closebtn: "skbclose",
_letterbtn: "skbbtn",
_maindiv: "skbsoftkeyboard",
_leftdiv: "skbleft",
_rightdiv: "skbright",
_keyboarddiv: "skbkeyboard",
_operationdiv: "skboperation",
_codetxt: "skbcode",
_resultsselect: "skbresults",
_postparamcode: "sfbcode",
_clearbtnviewname: "clear",
_delbtnviewname: "delete",
_querybtnviewname: "query",
_closebtnviewname: "close"
}, //外掛程式的相關元素命名
listmultiple: true, //select是否展開
simplekeyboard: true, //是否顯示大寫字母
onlykeyboard: false, //是否帶查詢功能
maxlength: null, //可輸入的最大長度
requestdataurl: null, //查詢資料的post地址
oncompleted: function (data) { }, //完成時出發此時間
onkeydown: function (data) { } //按鍵時出發此事件
};

外掛程式的使用方法
使用方法
複製代碼 代碼如下:
<link href="softkeyboard.css" rel="stylesheet" type="text/css" />
<script src="jquery-1.6.2.js" type="text/javascript"></script>
<script src="jquery.softkeyboard.js" type="text/javascript"></script>

在頁面中加入一個文字框使用方法2
<input type="text" class="querytxt" />
為class為querytxt的文字框使用外掛程式
複製代碼 代碼如下:
<script type="text/javascript">
$(".querytxt").softkeyboard()
</script>

更改相關參數
複製代碼 代碼如下:
$(".querytxt").softkeyboard({
simplekeyboard: true,
listmultiple: true,
maxlength: 10,
onkeydown: function (d) { alert(d) },
requestdataurl: "GetData.ashx",
onlykeyboard: true
})

其中GetData.ashx返回的json資料格式類似如下
複製代碼 代碼如下:
[{code:"DL",name:"大連"},{code:"DT",name:"大同"},{code:"DL",name:"大理"}]

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.