Simple formatage css + javascript
Bonjour,
lors d'un clic sur un lien, j'aimerais qu'il devienne gras, puis si je reclique sur ce lien, j'aimerais qu'il redevienne normal.
J'ai essayé ceci sans succès :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| <script language="JavaScript">
function forma(){
if (document.getElementById('l').style.fontWeight='bold'; = true){
document.getElementById('l').style.fontWeight='normal';}
if (document.getElementById('l').style.fontWeight='normal'; = true){
document.getElementById('l').style.fontWeight='bold';}
}
</script>
</head>
<body>
<a href="#" onClick="forma();" id="l">lien</a>
</body>
</html |