当在没有javascript支持的情况下加载页面时,如何在文本框中放置光标(自动对焦)? [英] How to place the cursor (auto focus) in text box when a page gets loaded without javascript support?
问题描述
我有一个带有一些文本字段的表单,并且当页面加载时,我想将光标(自动对焦)放置在表单的第一个文本字段上。
I have a form with some text fields,and I want to place the cursor (auto focus) on first text field of form when page gets loaded.
我不想使用javascript来做。
I want to do it without using javascript.
推荐答案
。
我们可以使用html5 自动对焦属性
例如:
载
Ya its possible to do without support of javascript..
We can use html5 auto focus attribute
For Example:
<input type="text" name="name" autofocus="autofocus" id="xax" />
如果在文本字段中使用它(autofocus =autofocus)意味着文本字段在页面get loaded。
有关详情:
http:// www.hscripts.com/tutorials/html5/autofocus-attribute.html
If use it (autofocus="autofocus") in text field means that text field get focused when page gets loaded..
For more details:
http://www.hscripts.com/tutorials/html5/autofocus-attribute.html
这篇关于当在没有javascript支持的情况下加载页面时,如何在文本框中放置光标(自动对焦)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!