<input type="text" id="my" name="my"  />
<script type="text/javascript">
    $("#my").focus();
</script>

上面的代码在IE下是没有任何问题的,但是不兼容FF,在FF没有反应
解决办法:兼容写法 IE和FF下focus()事件完美兼容:

<script type="text/javascript">
    setTimeout(function () { $("#my").focus(); }, 0);
</script>

 

相关文章:

  • 2021-08-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2021-07-04
  • 2022-12-23
猜你喜欢
  • 2021-07-22
  • 2021-09-04
  • 2022-02-18
  • 2022-12-23
  • 2021-08-12
相关资源
相似解决方案