JAVA/자바스크립트
자바스크립트 마우스오버,마우스아웃 이벤트예제
왕왕왕왕
2014. 10. 3. 16:20
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
<style>
input {
width: 200px;
background-color: gray;
}
</style>
</head>
<body>
<table align="center">
<tr>
<td><input type="button" value="첫번째버튼"
onmouseover="yellowBtn(this)" onmouseout="grayBtn(this)"></td>
</tr>
</table>
</br>
</br>
</br>
<table align="center">
<tr>
<td><input type="button" value="두번째버튼"
onmouseover="redBtn(this)" onmouseout="grayBtn(this)"></td>
</tr>
</table>
<script type="text/javascript">
function yellowBtn(e) {
e.style.background = "yellow";
}
function redBtn(e) {
e.style.background = "red";
}
function grayBtn(e) {
e.style.background = "gray";
}
</script>
</body>
</html>