Forum de discussion
Forum « Programmation Javascript » (archives)
menu switchmenu
Envoyé: 2 novembre 2003, 16h22 par bambina100
j'ai un ti prob dans mon menu, voici mon code :
<html>
<head>
<title>Switch Menu</title>
<style type="text/css">
<script type="text/javascript">
function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("cont").getElementsByTagName("DIV");
if(el.style.display == "none"){
for (var i=0; i<ar.length; i++){
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}
document.onselectstart = new Function("return false");
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div id="cont">
<span id="menu1" onclick="SwitchMenu('sub1')">
<IMG NAME="menu_1" border="0" src="img/navigation/menu_1.gif" width="177" height="23" onMouseover="menu_1.src='img/navigation/menu_1_o.gif'" onMouseout="menu_1.src='img/navigation/menu_1.gif'"></span><br>
<div id="sub1" style="display:none;">
<a href="#" title="Scrolling Text"><IMG NAME="menu_11" border="0" src="img/navigation/menu_11.gif" width="177" height="18" onMouseover="menu_11.src='img/navigation/menu_11_o.gif'" onMouseout="menu_11.src='img/navigation/menu_11.gif'"></a><br>
<a href="#" title="Static Ticker"><IMG NAME="menu_12" border="0" src="img/navigation/menu_12.gif" width="177" height="18" onMouseover="menu_12.src='img/navigation/menu_12_o.gif'" onMouseout="menu_12.src='img/navigation/menu_12.gif'"></a><br>
<a href="#" title="Zoom Intro"><IMG NAME="menu_13" border="0" src="img/navigation/menu_13.gif" width="177" height="18" onMouseover="menu_13.src='img/navigation/menu_13_o.gif'" onMouseout="menu_13.src='img/navigation/menu_13.gif'"></a><br>
<a href="#" title="Zoom Intro"><IMG NAME="menu_14" border="0" src="img/navigation/menu_14.gif" width="177" height="18" onMouseover="menu_14.src='img/navigation/menu_14_o.gif'" onMouseout="menu_14.src='img/navigation/menu_14.gif'"></a><br>
<a href="#" title="Zoom Intro"><IMG NAME="menu_15" border="0" src="img/navigation/menu_15.gif" width="177" height="18" onMouseover="menu_15.src='img/navigation/menu_15_o.gif'" onMouseout="menu_15.src='img/navigation/menu_15.gif'"></a><br>
<a href="#" title="Zoom Intro"><IMG NAME="menu_16" border="0" src="img/navigation/menu_16.gif" width="177" height="18" onMouseover="menu_16.src='img/navigation/menu_16_o.gif'" onMouseout="menu_16.src='img/navigation/menu_16.gif'"></a><br>
</div>
<span id="menu2" onclick="SwitchMenu('sub2')">
<IMG NAME="menu_2" border="0" src="img/navigation/menu_2.gif" width="177" height="20" onMouseover="menu_2.src='img/navigation/menu_2_o.gif'" onMouseout="menu_2.src='img/navigation/menu_2.gif'"></span><br>
<div class="submenu" id="sub2" style="display:none;">
<a href="#" title="Static Ticker"><IMG NAME="menu_21" border="0" src="img/navigation/menu_21.gif" width="177" height="18" onMouseover="menu_21.src='img/navigation/menu_21_o.gif'" onMouseout="menu_21.src='img/navigation/menu_21.gif'"></a><br>
<a href="#" title="Zoom Intro"><IMG NAME="menu_22" border="0" src="img/navigation/menu_22.gif" width="177" height="18" onMouseover="menu_22.src='img/navigation/menu_22_o.gif'" onMouseout="menu_22.src='img/navigation/menu_22.gif'"></a><br>
<a href="#" title="Zoom Intro"><IMG NAME="menu_23" border="0" src="img/navigation/menu_23.gif" width="177" height="18" onMouseover="menu_23.src='img/navigation/menu_23_o.gif'" onMouseout="menu_23.src='img/navigation/menu_23.gif'"></a><br>
<a href="#" title="Zoom Intro"><IMG NAME="menu_24" border="0" src="img/navigation/menu_24.gif" width="177" height="18" onMouseover="menu_24.src='img/navigation/menu_24_o.gif'" onMouseout="menu_24.src='img/navigation/menu_24.gif'"></a><br>
<a href="#" title="Zoom Intro"><IMG NAME="menu_25" border="0" src="img/navigation/menu_25.gif" width="177" height="18" onMouseover="menu_25.src='img/navigation/menu_25_o.gif'" onMouseout="menu_25.src='img/navigation/menu_25.gif'"></a><br>
</div>
</div>
</body> </html>
Voici mon problème :
je veux que lorsque je clique sur un image de mon menu, remplacer l'image qui est existante par une autre image du genre 'menu_1_a.gif, menu_2_a.gif" etc...
quelqu'un pourrait me mettre sur une piste? Merci!
Réponses
|