ITeye博客

tab键的焦点始终在一个层里面

tdmlxq · 2010-05-06 17:24 · JAVASCRIPT · Web前端 · Markdown

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>Untitled Document</title>
        <script type="text/javascript" src="./javascripts/jquery-1.4.2.js"></script>
        <script type="text/javascript">
            $(function(){
                $('.modeDiv input:last').keydown(function(e){
                    if (e.keyCode == 9) {
                        $('.modeDiv input:first').focus();
                        return false;
                    }
                });

            });
        </script>
    </head>
    <body>
        <div class="modeDiv">
            <form action="#" method="post">
                <table class="login_table">
                    <tr>
                        <td>用户名:</td>
                        <td>
                            <input id="username" type="text" size="30" name="username" value="">
                        </td>
                    </tr>
                    <tr>
                        <td>密码:</td>
                        <td>
                            <input id="password" type="password" size="30" name="password" value="">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="align_right">
                            <input id="login" type="button" value="登录" />
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </body>
</html>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。