<input type="text" />
<input type="text" />
<input type="text" />
<input type="text" />
<input type="text" />
$(function(){
$("input[type='text']").keydown(function(){
var e = $(this).event || window.event;
var code = parseInt(e.keyCode);
if (code >= 96 && code <= 105 || code >= 48 && code <= 57 || code == 8 || code == 9) {
return true;
} else {
return false;
}
})
})
问题:现在只能输入数字和删除键,我想让这些文本框可以Ctrl+C Ctrl+V 复制 粘贴
这样可以输入Ctrl+C Ctrl+V。。但也可以输入C。。V。。自己再想下巴
<input type="text" />
<input type="text" />
<script>
$(function(){
$("input[type='text']").keydown(function(){
var e = $(this).event || window.event;
var code = parseInt(e.keyCode);
if(e.ctrlKey){
if(code == 67 || code == 86){
return true;
}
}else{
if (code >= 96 && code <= 105 || code >= 48 && code <= 57 || code == 8 || code == 9) {
return true;
} else {
return false;
}
}
})
})
</script>