2011-06-03

If ime on, keypress,keydown,keyup can not work well on Webkit based browser.


hi everyone

There will be an important defect on the keypress,keydown,keyup events , if users open their IMEs, because ime will eat  these key events. 

Try this example on Webkit based browser:
If ime off, the example work well.
If ime on, the example can not work.


<input id='castId' size="6" type="text" maxlength="6" onkeyup="checkCastId(this)" style="ime-mode: disabled;" />
<button id="openCastIdBtn" disabled="disabled">Open Cast</button>
<script>
function checkCastId(me){
console.log(me.value);
if(/[6-9]{6}/.test(me.value)){
document.getElementById("openCastIdBtn").disabled = "";
}
else{
document.getElementById("openCastIdBtn").disabled = "disabled";
}
}
</script>

没有评论:

所见所闻所思

博客归档