Bonjour a tous
Je suis novice et j'ai un petit soucis avec un menu dynamique en javascript, je ne vais pas rentrer dans de grandes explication mais tenter de simplifier au maximum :
Soit deux liens, lien a et lien b
Je voudrais pouvoir modifier le background de lien a au survol de lien b
J'ai tenté d'ecrire une fonction, elle ne génère pas d'erreur mais cela ne fonctionne pas, la voici :
Si vous avez une solution, elle est bienvenue car je m'arrache les cheveux :o)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 html : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Document sans nom</title> <link href="liens.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="liens.js"></script> </head> <body> <p><a href="#" id="liena">lien a</a> </p> <p><a href="#" onfocus="javascript:lien();">lien b</a></p> </body> css : a:hover {background-color:red;} a.noir {background-color : black;} javascript : function lien(){ document.getElementById('liena').className='noir'; }
Partager