OnKeyPress第一次时,如何是为空的值呢

OnKeyPress第一次时,怎么是为空的值呢?input idmytel typetext OnKeyPressgetkey() /script

OnKeyPress第一次时,怎么是为空的值呢?
<input id="mytel" type="text" OnKeyPress="getkey();" />
<script>
function getkey()
{
alert (document.getElementById("mytel").value);
}
</script>

打印结果先为空开始,输入123,打印出12 是怎么一回事呢?

[解决办法]
<input id="mytel" type="text" onkeyup="getkey();" />
<script>
function getkey()
{
alert (document.getElementById("mytel").value);
}
</script>

[解决办法]
用onkeyup或者onblur