web:javascript:mootools
Table des matières
Mootools
Propriétés
Checked
Pour changer la valeur checked sur un radio button par exemple, on ne peut pas faire
event.target.getElement('input').checked = true;
Avec Mootools, il faut pluttôt faire set() :
event.target.getElement('input').set('checked', true);
Sélection
Événements
Ajout d'un événement
En ayant plusieurs <input /> de type radio, on peut ajouter un événement onchange.
$$('input[name=selection]').each(function(e) { e.addEvent('click', this.InputSelection_OnChange); }.bind(this));
Ne pas oublier le .bind(this) pour que le contexte this quand on ajoute l'événement puisse avoir la fonction InputSelection_OnChange().
On peut utiliser aussi addEvents() :
$$('button[id^=btnAction]').addEvents({click: function(e) { this.DoAction(e.target.id); }.bind(this)});
Appels de services
Données du Query String
var portalRequestIDs = [window.location.search.substring(1).parseQueryString().prid];
Éléments
Créer un élément
var button = new Element('button', { 'type':'button', 'class':'button', 'text': 'Custom text' });
Sources
web/javascript/mootools.txt · Dernière modification : de 127.0.0.1
