51help TIY
码:
<html> <head> <script type="text/javascript" src="../jquery/jquery.js" tppabs="http://www.51help.tk/jquery/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("input").keydown(function(){ $("input").css("background-color","#FFFFCC"); }); $("input").keyup(function(){ $("input").css("background-color","#D6D6FF"); }); }); </script> </head> <body> Enter your name: <input type="text" /> <p>当发生 keydown 和 keyup 入内容。</p> </body> </html>
查看结果: