[JS + XUL]Changement du oncommand
Bonjour,
Dans le cadre du développement d'une extension pour FireFox 3 je rencontre un petit problème lorsque je tente de changer l'attribut oncommand d'un bouton de ma toolbar de façon dynamique. Voici le code (danger est un booléen) :
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
| var frameButton = document.getElementById("PishBar-Frame-Button");
if (danger){
frameButton.style.listStyleImage="url(\"chrome://phishbar/skin/Frame/stop_16.png\")";
frameButton.style.fontWeight="bolder";
frameButton.style.color="red";
frameButton.label=(nbFrame+nbDiff) + " suspicous element(s)";
var msg = "Some dangerous frames (webpage within the webpage) have been found : \n\n";
if(nbDiff>0){
msg+=nbDiff + " frame(s) on the webpage do not belong to the website adress displayed on your adress bar :\n";
for (var j=0; j<nbDiff; j++){
msg+=" - " + tabFrame[j] + "\n";
}
msg+="\n";
}
if(nbFrame>0){
msg+=nbFrame + " frame(s) contain other frame(s). This can be a way to hide malicious features.\n"
}
}
else{
frameButton.style.listStyleImage="url(\"chrome://phishbar/skin/Frame/22.png\")";
frameButton.style.fontWeight="normal";
frameButton.style.color="green";
frameButton.label="Structure is ok";
msg = "The structure of the webpage seems to be safe";
}
frameButton.oncommand="alert('"+msg+"')"; |
Le changement des attributs tels que le label et le style fonctionnent très bien mais pas celui du oncommand... Je comprends pas pourquoi... Quelqu'un a une idée ?