[ Index ] |
|
Code source de PRADO 3.0.6 |
1 /* 2 Behaviour v1.1 by Ben Nolan, June 2005. Based largely on the work 3 of Simon Willison (see comments by Simon below). 4 5 Description: 6 7 Uses css selectors to apply javascript behaviours to enable 8 unobtrusive javascript in html documents. 9 10 Usage: 11 12 var myrules = { 13 'b.someclass' : function(element){ 14 element.onclick = function(){ 15 alert(this.innerHTML); 16 } 17 }, 18 '#someid u' : function(element){ 19 element.onmouseover = function(){ 20 this.innerHTML = "BLAH!"; 21 } 22 } 23 }; 24 25 Behaviour.register(myrules); 26 27 // Call Behaviour.apply() to re-apply the rules (if you 28 // update the dom, etc). 29 30 License: 31 32 This file is entirely BSD licensed. 33 34 More information: 35 36 http://ripcord.co.nz/behaviour/ 37 38 */ 39 40 var Behaviour = { 41 list : new Array, 42 43 register : function(sheet){ 44 Behaviour.list.push(sheet); 45 }, 46 47 start : function(){ 48 Event.OnLoad(Behaviour.apply); 49 }, 50 51 apply : function(){ 52 for (h=0;sheet=Behaviour.list[h];h++){ 53 for (selector in sheet){ 54 list = document.getElementsBySelector(selector); 55 56 if (!list){ 57 continue; 58 } 59 60 for (i=0;element=list[i];i++){ 61 sheet[selector](element); 62 } 63 } 64 } 65 } 66 } 67 68 Behaviour.start();
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 21:07:04 2007 | par Balluche grâce à PHPXref 0.7 |