donner un evenement disabled a un bouton
bonjour,
j ai un probleme que j arrive pas a resoudre. en effet, je voudrais qu en appuyant sur un bouton, je desactive un autre bouton.
Je pensais que c etais pas dur mais cela ne marche pas.
voici les codes de ma page jsp:
Code:
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
...
<script language="javascript">
....
function afficher(){
if(true){
document.getElementById('champVal2').style.display = "";
}
else{
document.getElementById('champVal2').style.visibility = "visible";
}
}
function cacher(){
if(true){
document.getElementById('champVal2').style.display = "none";
}
else{
document.getElementById('champVal2').style.visibility = "hidden";
}
}
function enlever(){
// document.getElementById('listNew').disabled ;
document.forms[0].elements['listNew'].disabled = true;
}
....
</script>
</head>
<body onLoad="demarrage()">
.....
<br><br>
<form name="formNew" method="post" action="<c:url value="/queries/ed/action.do" />" >
<input type="hidden" name="windowId" value="${param.windowId}" />
<input type="hidden" name="listNew" />
....
.....
<td width="27"> <input type="button" value="=" name="operateur1" onClick="affValeur(this); DonnerFocus();cacher()"></td>
<td width="27"> <input type="button" value=">" name="operateur2" onClick="affValeur(this); DonnerFocus();cacher()"></td>
<td width="36"> <input type="button" value=">=" name="operateur3" onClick="affValeur(this); DonnerFocus();cacher()"></td>
<td width="37"> <input type="button" value="<=" name="operateur6" onClick="affValeur(this); DonnerFocus();cacher()"></td>
<td width="31"> <input type="button" value="<" name="operateur5" onClick="affValeur(this); DonnerFocus();cacher()"></td>
<td width="45"> <input type="button" value="<...<" name="operateur4" onClick="affValeur(this); DonnerFocus();enlever();afficher();"></td>
<td width="53"> <input type="button" value="<=...<" name="operateur7" onClick="affValeur(this); DonnerFocus();afficher();enlever()"></td>
<td width="54"> <input type="button" value="<...<=" name="operateur8" onClick="affValeur(this); DonnerFocus();afficher();enlever()"></td>
<td width="73"> <input type="button" value="<=...<=" name="operateur9" onClick="affValeur(this); DonnerFocus();afficher();enlever()"></td>
<td width="47"> <input type="button" value="Like" name="operateur10" onClick="affValeur(this); DonnerFocus();cacher()"></td>
<td width="37"> <input type="button" value="!=" name="operateur13" style="width:30" onClick="affValeur(this); DonnerFocus();cacher()"></td>
<td width="90"> <input type="button" value="Is Empty" name="operateur11" onClick="affValeur(this); DonnerFocus();cacher()"></td>
<td><input type="button" value="Is Not Empty" name="operateur12" onClick="affValeur(this); DonnerFocus();cacher()"></td>
</tr>
</table>
</fieldset>
<p align="left"><input type="text" name="resultOp" size="10" value="${param['resultOp']}"></td>
</tr>
<tr>
<td valign="top">
<fieldset style="padding: 2; width:200px; height:50px" >
<legend>Value1</legend>
<table >
<tr>
<td><input type="text" name="valeur1" size="20" value="${param['valeur1']}" > </td>
<td> <input type="button" value="List" name="listNew" onClick="afficheList()" ></td>
</tr>
</table>
</fieldset>
......
</table>
</form>
</body>
</html> |
la function enlever() ne met pas le bouton listNew a disabled.
Si quelqu un peut m aider.