<script type="text/javascript"> function changeStyle(elem, color){ elem.style.backgroundColor = color; } </script> <div onmouseover="changeStyle(this, 'Yellow')" onmouseout="changeStyle(this, 'White')"> マウスを乗せると背景色が変わります。</div>
マウスを乗せると背景色が変わります。
<script type="text/javascript"> function changeStyle(elem, color){ elem.style.backgroundColor = color; } </script> <div onmouseover="changeStyle(this, 'Yellow')" onmouseout="changeStyle(this, 'White')"> マウスを乗せると背景色が変わります。</div>