간단한 이벤트 처리
1846 단어 이벤트
var oldColor;
var oldSize;
function clickDiv(obj){
alert(event);
obj.style.color = '#foo';
obj.style.fontSize = '22px';
/*
obj.style obj style 。
obj.id id
style.color css 。 ,font-size,
text-decoration , :
fontSize,textDecoration
*/
}
function mouseover(obj){
oldcolor = obj.style.color;
/* css font-Size , js
( );
*/
oldSize = obj.style.fontSize;
obj.style.color = '#foo';
obj.style.fontSize = '22px';
}
function mouseout(obj){
obj.style.color = oldColor;
obj.style.fontSize = oldSize;
}
<body>
<div onclick = 'clickDiv(this)' > </div>
<div onmouseover = "mouseover(this)" onmouseout = "mouseout(this)"> </div>
</body>