<html>
<head>
<title>自动获得焦点</title>
<meta name="author" content="Yeeku.H.Lee(CrazyIt.org)" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
姓名:<input type="textarea" name="xinming"/><br/>
年龄:<input type="textarea" autofocus name="age"/>
</html>
<!-- HTML5自动获取焦点, autofocus-->
<!-- HTML获取焦点,比较 -->
<html>
<head>
<title>不是自动获取焦点</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
姓名:<input type="text" name="xinming" id="xinming"/><br/>
年龄:<input type="text" name="age" id="age"/>
</body>
</html>
<script type="text/javascript">
document.getElementById("xinming").focus();
</script>
<!-- 普通用js获取-->