リンクメニューの背景色と文字色を変化させる。
|
| Sample |
|
abcdef
zyxwv |
| ソース |
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function mouse_on(item, color, bg) {
item.style.color = color;
item.style.backgroundColor = bg;
}
function mouse_off(item) {
item.style.color = "black";
item.style.backgroundColor = "";
}
//-->
</SCRIPT>
</HEAD>
<BODY bgcolor=white>
<a name="index1" href="#" onmouseover="mouse_on(index1, 'yellow','green');"
onmouseout="mouse_off(index1);">abcdef</a>
<br><br>
<a name="index2" href="#" onmouseover="mouse_on(index2, 'white','blue');"
onmouseout="mouse_off(index2);">zyxwv</a>
</BODY>
</HTML>
|
| ワンポイント解説 |
|
onmouseover="mouse_on(index1, 'yellow','green') で、文字の色を黄色、背景の色を緑色に指定しています。 |