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
| function addEvent(obj,event,fct){
if(obj.attachEvent)
obj.attachEvent('on' + event,fct);
else
obj.addEventListener(event,fct,true);
}
function removeEvent(obj,event,fct){
if (obj.detachEvent) {
obj.detachEvent("on" + event, fct);
}
else {
obj.removeEventListener(event, fct, true);
}
}
function toto()
{
alert("toto");
}
/* Pour ajouter la fonction à l'événement */
addEvent(onglet,"mouseout",toto);
/* Pour supprimer la fonction à l'événement */
removeEvent(onglet,"mouseout",toto); |
Partager