changer à chaque click nom d'un bouton
Bonjour,
mon besoin est dit dans le titre et ma tentative (ligne 11) échoue :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<script type="text/javascript">
function swap(){
for(i=0;i<=6;i++){
targetElement="Out"+i+"details";
Item = document.getElementById(targetElement);
Item.style.display= (Item.offsetWidth == 0)?"block":"none";
}
(document.getElementById(bouton).value==("Expand all"))?"Collapse All":"Expand All";
}
</script>
</head>
<body>
...
<input id="bouton" onclick="swap()" type="button">
...
</body> |
Comment faudrait-il faire ?