mirror of
https://github.com/wu736139669/vczero.github.io.git
synced 2026-08-05 06:23:38 +00:00
add test
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>模拟数字键盘</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, minimal-ui" />
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<input id="text1" type="number" style="ime-mode:disabled;height:28px;width:98%;outline:none;border:1px solid #1AB6FF;padding-left:3px;"/>
|
||||
<br />
|
||||
<br />
|
||||
<input id="text2" readonly="readonly" type="number" style="height:28px;width:98%;outline:none;border:1px solid #1AB6FF;padding-left:3px;"/>
|
||||
</div>
|
||||
<script type="text/javascript" src="keyboard.js"></script>
|
||||
<script type="text/javascript">
|
||||
(function(){
|
||||
var input1 = document.getElementById('text1');
|
||||
var input2 = document.getElementById('text2');
|
||||
|
||||
input1.onclick = function(){
|
||||
new KeyBoard(input1);
|
||||
};
|
||||
|
||||
input2.onclick = function(){
|
||||
new KeyBoard(input2);
|
||||
};
|
||||
|
||||
input1.onkeypress = noPermitInput;
|
||||
|
||||
function noPermitInput(e){
|
||||
var evt = window.event || e ;
|
||||
if(isIE()){
|
||||
evt.returnValue = false; //ie 禁止键盘输入
|
||||
}else{
|
||||
evt.preventDefault(); //fire fox 禁止键盘输入
|
||||
}
|
||||
}
|
||||
|
||||
function isIE() {
|
||||
if (window.navigator.userAgent.toLowerCase().indexOf("msie") >= 1)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user