0
之前運行,這是我的代碼:事件點擊按鈕
<body>
<button id="mybtn">Click Me!</button>
<script>
document.getElementById("mybtn").onclick = sum(2,5);
function sum(a,b) {
document.getElementById("x").innerHTML = a + b;
}
</script>
</body>
爲什麼文件顯示7點擊按鈕之前?
'onclick = function(){sum(2,5);}' –