본문 바로가기

카테고리 없음

[자바스크립트] [테이블] 테이블에 마우스 롤오브시 표의 셀 색상 바꾸기

에디터에서 표를 만든다음 색상을 바꿀 셀에서 마우스 오른쪽 버튼을 누른후 셀 속성을 선택합니다. 그후 확장(X) 버튼을 누른후 추가(A)버튼을 눌러 2가지 항목을  다음과같이 입력합니다.

이름(N) : onmouseout      <-- 마우스를 올리지 않았을때
값(V) : this.style.backgroundColor='#FFFFFF'   <-- 색상값

이름(N) : onmouseover    <-- 마우스를 올렸을 때
값(V) : this.style.backgroundColor='#ffcc00'     <-- 색상값


== <예제>================================================================

<div align="center"><table border width="90%">
    <tr>
        <td width="607" onmouseout="this.style.backgroundColor='silver'" onmouseover="this.style.backgroundColor='#ffcc00'"><p> </td>
        <td width="607" onmouseout="this.style.backgroundColor='silver'" onmouseover="this.style.backgroundColor='red'"><p> </td>
    </tr>
    <tr>
        <td width="607" onmouseout="this.style.backgroundColor='silver'" onmouseover="this.style.backgroundColor='green'"><p> </td>
        <td width="607" onmouseout="this.style.backgroundColor='silver'" onmouseover="this.style.backgroundColor='white'"><p> </td>
    </tr>
</table></div>

===============================================================================