<html>
<head>
<script>
window.onload=function(){
b.onclick=a;
}
function a(){
//b.style.background="red";
//this.style.background="red";
event.srcElement.style.background="red";
}
</script>
</head>
<body>
<input type="button" id="b">
</body>
</html>
'개발하자 > 자바스크립트' 카테고리의 다른 글
배열{키:값,키:값,키:값} (0) | 2015.02.14 |
---|---|
substring(n1[,n2]) (0) | 2015.02.14 |
onmouseover,onmouseout (0) | 2015.02.14 |
원하는 객체의 값 변경(강아지 이름 변경 예제) (0) | 2015.02.14 |
원하는 객체의 값 변경(자동차 색상 예제) (0) | 2015.02.14 |