<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ϵͳ</title>
<script type="text/javascript">
document.getElementById("btn").οnclick=function(){alert("214")};
</script>
<body>
<input type="button" id="btn" name="name" value="11">
</body>
</html>
=======================================
解决方案
1, <script type="text/javascript">
document.getElementById("btn").οnclick=function(){alert("214")};
</script> 放input框后
2,让其自动加载
window.οnlοad=function(){}