想做一个点击按钮后,一段文字出现在屏幕上,刚刚开始学js,
console里一直提示 pickme is not defined。
<html>
<head>
<title>测试</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script type="text/javascript">
window.onload = function() {
function pickme() {
var pickup = document.getElementById('pickup');
var textbox =document.getElementById('textbox');
textbox.innerHTML="你点击了按钮";
}
}
</script>
</head>
<body>
<div style="background-color: #dddddd;height:400px;">
</div>
<div id="textbox" style="height: 200px;">
<button id="pickup" onclick="pickme()" type="button" style="margin: 15px;width: 100px;height:50px;">按钮</button>
</div>
</body>
</html>
人到中年有点甜
相关分类