单击链接后,下面的代码会聚焦文本输入.它适用于Chrome 2.x,IE8和Opera 9.64,但不适用于Firefox 3.0.9.文本输入在Firefox中快速闪烁然后消失,我目前正在使用Windows XP SP2.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script>
$(document).ready(function()
{
$("a").click(function() {
var field_id = $(this).attr("href");
$(field_id).focus();
});
});
</script>
<a href="#text_field">Focus</a>
<input type="text" name="text_field" id="text_field" />
Run Code Online (Sandbox Code Playgroud)
有谁知道如何在Firefox中处理上述内容?