Does anyone know what is going on here? When I pressed the key once, in IE8 it's always calls the function in javascript twice. It's working fine by only call the fundtion once when the keypredd in firefox but not in IE8.
HTML:
<input onkeypress="return isNumberKey(event, this);" />
Javascript:
function isNumberKey(evt, obj)
{
alert('unavailable').
return false
}
Does anyone know what is going on here? When I pressed the key once, in IE8 it's always calls the function in javascript twice. It's working fine by only call the fundtion once when the keypredd in firefox but not in IE8.
HTML:
<input onkeypress="return isNumberKey(event, this);" />
Javascript:
function isNumberKey(evt, obj)
{
alert('unavailable').
return false
}
Share
Improve this question
edited Sep 8, 2009 at 1:58
Jin Yong
asked Sep 8, 2009 at 1:13
Jin YongJin Yong
43.8k72 gold badges144 silver badges194 bronze badges
1 Answer
Reset to default 2Works 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 the title get appended a single "1" at a time. Maybe you have some other code going amiss? Your posted code has an obvious syntax error, so maybe there's something else you're leaving out?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744791441a4593938.html
评论列表(0条)