DOM0級(jí)問(wèn)題
<body>
<input type="button" name="按鈕" value="按鈕1" id="btn1" onclick="showthis()">
<input type="button" name="按鈕" value="按鈕2" id="btn2" >
<script>
var btn1=document.getElementByid('btn1');
var btn2=document.getElementByid('btn2');
function showthis(){
alert('彈出框');
}
btn2.onclick=function(){
alert("hello js");
}
</script>
</body>
請(qǐng)問(wèn)點(diǎn)擊按鈕2為什么沒(méi)效果?
2017-10-15
getElementByid寫(xiě)錯(cuò)了,是getElementById;