7
A
回答
3
你将不得不依靠javascript来做到这一点,因为IE5不支持html5自动对焦。这里有一篇很好的博客文章:http://www.html5tutorial.info/html5-autofocus.php
基本上,你首先检查属性是否受支持,然后使用javascript手动对焦使用focus()
方法,如果不是。
-3
自动对焦在IE浏览器只是
<input type="text" id="searchbar" autofocus />
不
<input type="text" id="searchbar" autofocus="autofocus"/>
更多信息,请参见http://msdn.microsoft.com/en-us/library/windows/apps/hh441087(v=vs.85).aspx。
2
+0
这是最好的方法,因为这可以在所有浏览器中工作。 – DannyCruzeira
32
这里是一个一行(当然,实际的逻辑之一线)使用jQuery来使自动对焦工作在IE中。如果焦点已经确定 - 换句话说,在任何支持HTML5的浏览器中,它都会被释放出来。
$(function() {
$('[autofocus]:not(:focus)').eq(0).focus();
});
我解释了它是如何工作的in my blog。而here是一个更新的jsFiddle在IE中工作。
相关问题
- 1. 在Internet Explorer中自动输入数据
- 2. 如何让textarea在Internet Explorer中加载时自动对焦工作
- 3. AngularJS输入自动对焦
- 4. 如何在IE浏览器的自动对焦上进行输入?
- 5. 如何在Internet Explorer中自动执行链接
- 6. 输入自动对焦属性
- 7. 使用Internet Explorer进行$(输入).change时出现的问题
- 8. Jquery自动对焦第二个输入
- 9. 如何自动在IE(Internet Explorer)上执行“另存为”?
- 10. 使用VBA输入事件的Internet Explorer自动化
- 11. 如何在Internet Explorer中运行vbs
- 12. 如何在Internet Explorer中运行fullCalendar?
- 13. 故障自动化Internet Explorer
- 14. 如何在Internet Explorer 6中的输入框上悬停效果
- 15. ios 10自动对焦不对焦输入
- 16. Internet Explorer中的输入文件长度
- 17. 在Internet Explorer中动态创建文件输入
- 18. HTML5:是自动对焦=“自动对焦”或自动对焦
- 19. 在Internet Explorer中自动调整jQuery UI对话框的大小
- 20. Internet Explorer文本输入onkeyup char 13
- 21. VBA和Internet Explorer:填写输入框
- 22. Internet Explorer表单输入问题
- 23. jQuery的自动完成功能无法清空在Internet Explorer上输入
- 24. 如何在Internet Explorer获得焦点时得到通知
- 25. 在Internet Explorer中输入文本中的垂直居中文本
- 26. 在Internet Explorer中使用自动对焦时模式中的奇怪光标位置
- 27. 使用Internet Explorer进行调试
- 28. Internet Explorer上的光标焦点问题
- 29. asp.net Internet Explorer窗口焦点故障
- 30. 与在Internet Explorer(浮动)
从今天开始,12/13/2016,autofocus关键字在Windows 10的IE 11.0.36中运行,但在Windows 7上的IE 11.0.35中运行。非常令人烦恼。 –