JavaScript事件onkeypress

来源:互联网 发布:单代号搭接网络 编辑:程序博客网 时间:2024/06/06 03:41
<!DOCTYPE html><html><head><script>function myFunction(){alert("You pressed a key inside the input field");}</script></head><body><p>A function is triggered when the user is pressing a key in the input field.</p><input type="text" onkeypress="myFunction()"></body></html>
原文:http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onkeypress