首先說明,是參考的qq36622469發佈的js軟鍵盤,而後根據裏面的使用不太方便的地方進行修改,使其適合在開發中方便引用javascript
效果圖:css
以前的版本是要在頁面中分別添加js的引用,並且還要單獨定義樣式表,不方便批量調用html
<style type="text/css"> .btn_letter {width:25px;BORDER: 1px solid #7b9ebd; PADDING: 1px 1px 0px 2px; FONT-SIZE: 14px; CURSOR: point; height:20px; COLOR: #075bc3;font-family: Arial;} .btn_num {width:25px;BORDER:1px solid #7ebf4f; PADDING: 1px 1px 0px 2px;FONT-SIZE: 12px; CURSOR: point; height:20px;COLOR: black; font-family: Arial;} .btn_input {BORDER:1px solid #2C59AA; PADDING:2px 2px 0px 2px; FONT-SIZE:12px;CURSOR:pointer; COLOR:black; font-family: Arial;} </style> <script type="text/javascript" src="JustWalking.js"></script> </head> <body> <div align="center" style="width:50%;height:600px; overflow:hidden;"> <INPUT id="userPW" name="userPW" type="password" onfocus="softFn.pwInputFocus(this);" onchange="softFn.pwInputChange(this);" maxLength="20" minLength="6" readOnly /> </div> <script type="text/javascript" src="softKeyBoard.js"></script>
修改後將樣式表分別定義爲style.css樣式表,而且js動態調用,這樣在頁面中只須要引用一個js文件,樣式表也不用另外調用java
<INPUT id="userPWDSoftKey" name="userPW" type="password" maxLength="20" minLength="6" readOnly /> <script type="text/javascript" src="softKeyBoard.js"></script> <script type="text/javascript"> initSoftKeyBoard("userPWDSoftKey"); </script>
具體源代碼能夠在這裏下載:http://download.csdn.net/detail/songylwq/4999645
this