Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>本教程(w3big.com)</title> <script src="http://cdn.static.w3big.com/libs/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("input").keydown(function(){ $("input").css("background-color","yellow"); }); $("input").keyup(function(){ $("input").css("background-color","pink"); }); }); </script> </head> <body> 输入你的名字: <input type="text"> <p>在以上输入框中输入你的名字。在按键按下后输入框背景颜色会改变。</p> </body> </html>