html4和html5区别之如何在一个input上添加焦点实现代码
发布时间:2017-01-07 来源:查字典编辑
摘要:html4:Username:document.getElementById('search').focus()html5:Search:
html4:
<form>
<p><label>Username:<input name=search type="text" id="search"></label></p>
<script type="text/javascript">
document.getElementById ('search').focus()
</script>
</form>
html5:
<form>
<p>
<label>Search:<input name=search autofocus></label>
</p>
</form>