html4和html5差别之怎样在1个input上加上聚焦点完成


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>