87,910
社区成员
发帖
与我相关
我的任务
分享
function InputChange() {
if (String.fromCharCode(event.keyCode) == "A")
{ alert('false'); return false; }
alert('true');
return true;
}
<Textarea id="TextArea1" style="width:1000px; height:300px; border-color:Green;" onkeydown="return InputChange();"></Textarea>
function InputChange() {
if (String.fromCharCode(event.keyCode) == "A")
{
setTimeout(function(){
alert('false');
},1)
return false;
}else {
alert('true');
return true;
}
}
function InputChange() {
if (String.fromCharCode(event.keyCode).toLocaleUpperCase() == "A")
{
alert('false');
return false;
}
alert('true');
return true;
}
<Textarea id="TextArea1" style="width:1000px; height:300px; border-color:Green;" onkeypress ="return InputChange();"></Textarea>
<Textarea id="TextArea1" style="width:1000px; height:300px; border-color:Green;" onkeydown="return InputChange(event);"></Textarea>
<script>
function InputChange(e) {return e.keyCode!=65; }
</script>