Onkeypress = "return isNumberKey (event, this);" call a function twice in IE8 per click in javascript

Does anyone know what's going on here? When I pressed the key once, in IE8 it always calls the function in javascript twice. It works great, only call the foundation when the key is in firefox but not in IE8.

HTML:

<input onkeypress="return isNumberKey(event, this);"  />

      

JavaScript:

function isNumberKey(evt, obj)
{

    alert('unavailable'). 
    return false

}

      

+2


source to share


1 answer


Works for me IE8 on Vista, (8.0.6001.18813)

<script>
function isNumberKey() {
    document.title += 1;
    return false;
}
</script>
<input type="text" onkeypress="return isNumberKey();">

      



I only see that the title adds one "1" at a time. Maybe you have some other code? Your posted code has an obvious syntax error, so maybe there is something else you are missing?

+2


source







All Articles