jQuery表单事件
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>表单事件</title>
- </head>
- <style type="text/CSS" rel="stylesheet">
- .input_focus{
- background-color: #BEE7FC;
- }
- </style>
- <script type="text/javascript" src1="js/jquery-1.8.3.js"></script>
- <script language="JavaScript">
- $(document).ready(function () {
- $("[name=member]").focusin(function () {
- $(this).addClass("input_focus");
- });
- $("[name=member]").blur(function () {
- $(this).removeClass("input_focus");
- });
- });
- </script>
- <body>
- <div id="login">
- <fieldset>
- <legend>用户登录</legend>
- <p>
- <label>用户名:</label>
- <input name="member" type="text" />
- </p>
- <p>
- <label>密码:</label>
- <input name="password" type="text" />
- </p>
- <p>
- <label>验证码:</label>
- <input name="code" type="text" class="code" />
- <img src1="images/code.gif" width="80" height="30" /><a href="#">换一张</a>
- </p>
- <p>
- <input name="" type="button" class="btn" value="登录" />
- <a href="#">注册</a><span>|</span><a href="#">忘记密码?</a>
- </p>
- </fieldset>
- </div>
- </body>
- </html>
来源: https://www.oschina.net/code/snippet_2887409_58705