Knowledge Base Nr: 00264 ajax5.txt - http://www.swe-kaiser.de

Downloads:

AJAX: menu beleben (hintergrundfarbe unter maus wechseln, zuletzt gewählter eintrag kursiv)

  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>menue test</title>

<script type="text/javascript">
var menuidlast = null;
var menubgcolorlast = null;

function select_on(menuid)
{
var menuitem = document.getElementById(menuid);

if (menuitem != null)
{
menubgcolorlast = menuitem.style.backgroundColor;
menuitem.style.backgroundColor = "#ffffff";
}
}

function select_off(menuid)
{
var menuitem = document.getElementById(menuid);

if (menuitem != null)
{
menuitem.style.backgroundColor = menubgcolorlast;
}
}

function select_current(menuid)
{
if (menuidlast != null)
{
var menuitemlast = document.getElementById(menuidlast);

if (menuitemlast != null)
{
menuitemlast.style.fontStyle = "normal";
menuitemlast.style.backgroundColor = menubgcolorlast;
}
}

menuidlast = menuid;

var menuitem = document.getElementById(menuid);

if (menuitem != null)
{
menuitem.style.fontStyle = "italic";
menuitem.style.backgroundColor = "#ffffff";
}
}
</script>


</head>

<body>
<table>
<tr>
<td nowrap bgcolor="#00ffff" valign="top" align="left">
<a id="lexikon" onmouseover="select_on('lexikon')" onmouseout="select_off('lexikon')" onclick="select_current('lexikon')" target="inhalt2" href="http://www.wikipedia.org">Lexikonrecherche</a><br />
<a id="websuch" onmouseover="select_on('websuch')" onmouseout="select_off('websuch')" onclick="select_current('websuch')" target="inhalt2" href="/kaiserreich/k_search.html">Web-Suche</a><br />
<a id="tvprogs" onmouseover="select_on('tvprogs')" onmouseout="select_off('tvprogs')" onclick="select_current('tvprogs')" target="inhalt2" href="/kaiserreich/k_TVprog.php3">Fernsehprogramm</a><br />
<a id="woerter" onmouseover="select_on('woerter')" onmouseout="select_off('woerter')" onclick="select_current('woerter')" target="inhalt2" href="http://pda.leo.org">Wörterbuch</a><br />
</td>
</tr>
</table>

</body>
</html>