Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery Firefox focus以先输入后调出一个按钮_Jquery_Firefox_Tabs_Indexing_Focus - Fatal编程技术网

Jquery Firefox focus以先输入后调出一个按钮

Jquery Firefox focus以先输入后调出一个按钮,jquery,firefox,tabs,indexing,focus,Jquery,Firefox,Tabs,Indexing,Focus,我尝试在用户在表单上留下按钮后操纵焦点。离开后,焦点应设置为表单的第一个输入。但它不适用于Firefox。焦点首先转到当前选项卡,然后转到地址栏,然后再转到第一个输入。有没有办法解决这个问题?如果我在focusout中的focus之后设置了一个警报,我会看到第一个输入字段在短时间内具有焦点。以下是我的例子: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1 /DTD/x

我尝试在用户在表单上留下按钮后操纵焦点。离开后,焦点应设置为表单的第一个输入。但它不适用于Firefox。焦点首先转到当前选项卡,然后转到地址栏,然后再转到第一个输入。有没有办法解决这个问题?如果我在focusout中的focus之后设置了一个警报,我会看到第一个输入字段在短时间内具有焦点。以下是我的例子:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1 /DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
</head>
<body>
    <form>
        <input name="input1" tabindex="1"/>
        <input name="input2" tabindex="2"/>
        <button name="button" class="button" tabindex="3">Button</button>
    </form>
    <script type="text/javascript">
        $(document).ready(function(){
            $('input:first').focus();                
            $('.button').focusout(function(){
                $('input:first').focus();
            });
        });
    </script>       
</body>

按钮
$(文档).ready(函数(){
$('input:first').focus();
$('.button').focusout(函数(){
$('input:first').focus();
});
});