Q51. 다음은 문서 객체 모델(DOM)에서 발생되는 이벤트를 처리하는 예이다. 밑줄 친 부분을 채우시오. (400점)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
div {
color: white; background-color: skyblue;
padding: 10px; width: 200px; text-align: center;
}
</style>
<script>
function ______________(obj) {
obj.innerHTML = "클릭하셨네요!";
}
function ______________(obj) {
obj.style.backgroundColor = "orange";
}
function ______________(obj) {
obj.style.backgroundColor = "skyblue";
}
</script>
</head>
<h2 onclick="changeText(this)">클릭해 보세요!</h2>
<div onmouseover="mouseOver(this)" onmouseout="mouseOut(this)">
마우스를 올려보세요!
</div>
</body>
</html>
- 난이도(1~10) : 4
- - 실행 결과
-
클릭해 보세요!
마우스를 올려보세요!
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
div {
color: white; background-color: skyblue;
padding: 10px; width: 200px; text-align: center;
}
</style>
<script>
function changeText(obj) {
obj.innerHTML = "클릭하셨네요!";
}
function mouseOver(obj) {
obj.style.backgroundColor = "orange";
}
function mouseOut(obj) {
obj.style.backgroundColor = "skyblue";
}
</script>
</head>
<h2 onclick="changeText(this)">클릭해 보세요!</h2>
<div onmouseover="mouseOver(this)" onmouseout="mouseOut(this)">
마우스를 올려보세요!
</div>
</body>
</html>