꽤 간단하지만 웹을 실행할 때 경고가 전혀 들리지 않습니다! YouTube의 비디오와 똑같은 일을하고 있었지만, 그와 똑같은 일을하고 싶을 때 응답이 없습니다.왜 응답이 없습니까?
// this is my html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="shiyan.css">
</head>
<body>
<header>
<h1>Javascript Event</h1>
</header>
<main>
<h4> Add Numbers:</h4>
<p>
<input id = "num-one"> + <input id = "num-two">
</p>
<p id = "add-sum"></p>
</main>
<script src="shiyan.js"></script>
</body>
</html>
//here is my shiyan.js in the same file of html
var numOne = document.getElementById("num-one");
var numTwo = document.getElementById("num-two");
var addSum = document.getElementById("add-sum");
numOne.addEventListener("click ", function(){
alert("hahahahaa");
});
사용'' –
' "클릭"' "클릭"대신' "클릭"에 부유 공간을 제거하기''' "클릭"과 동일하지 않습니다 - 공간을 없애십시오 –