SkYlEsS
Elite
Mon but : changer la class d'un élément lors du passage de la souris + un clic n'importe où sur cet élément = clic sur le lien que contient l'élément ...
Code xHTML :
Code Javascript :
Mais rien ne fonctionne ... :[] Y a un truc qui m'échappe ... mais quoi ?
Code xHTML :
Code:
<table cellspacing="0" cellpadding="3" border="0">
<tr><td class="menutitle">Forums</td></tr>
<tr><td class="menusubtitle" onmouseover="switch_bg();" onmouseout="switch_bg();" onclick="tolink();"><a href="#">Gazette du Palais</a></td></tr>
<tr><td class="menusubtitle" onmouseover="switch_bg();" onmouseout="switch_bg();" onclick="tolink();"><a href="#">Cafétéria du Palais</a></td></tr>
</table>
Code Javascript :
Code:
function switch_bg()
{
this.ClassName = (this.ClassName == "menusubtitle") ? "menusubtitleover" : "menusubtitle";
hand_pointer(this);
}
function hand_pointer(Objet)
{
try
{
Objet.style.cursor = "pointer";
}
catch()
{
Objet.style.cursor = "hand";
}
}
function tolink()
{
Links = this.getElementsByTagName("a");
if (Links[0])
{
if (is_ie)
{
Links[0].click();
window.event.cancelBubble = true;
}
else
{
window.location = Links[0].href;
}
}
}