[ Index ] |
|
Code source de Plume CMS 1.2.2 |
1 // 2 // Common functions 3 // 4 function getElementsByNameAndClass(n,c,e) 5 { 6 if (!document.getElementsByTagName) { 7 return false; 8 } 9 10 var elements = new Array(); 11 12 if (e == undefined) { 13 e = document; 14 } 15 16 var col = e.getElementsByTagName(n); 17 if (col) { 18 for (var i=0; i<col.length; i++) { 19 var re = new RegExp("\\b" + c + "\\b"); 20 if (re.test(col[i].className)) { 21 elements.push(col[i]); 22 } 23 } 24 } 25 26 return elements; 27 }; 28 29 30 function checkBoxes(formid,sel) 31 { 32 if (!document.getElementById) { 33 return false; 34 } 35 36 var inputs = document.getElementById(formid).elements; 37 38 39 for (var i=0; i<inputs.length; i++) { 40 if (inputs[i].type == 'checkbox' && !inputs[i].disabled) { 41 if (sel == 'invert') { 42 inputs[i].checked = !inputs[i].checked; 43 } else if (sel == 'none') { 44 inputs[i].checked = false; 45 } else { 46 inputs[i].checked = true; 47 } 48 } 49 } 50 51 return false; 52 } 53 54 function getRadioValue(a) 55 { 56 if (a == undefined) { return null; } 57 58 for (var i=0; i<a.length; i++) { 59 if (a[i].checked) { 60 return a[i].value; 61 } 62 } 63 return null; 64 } 65 66 // 67 // Lock lockable input field, hide info and display unlock icon 68 function hideLockable() 69 { 70 var loc = getElementsByNameAndClass('div','lockable'); 71 for (var i=0; i<loc.length; i++) 72 { 73 var inputs = loc[i].getElementsByTagName('input'); 74 inputs[0].disabled = true; 75 inputs[0].style.width = (inputs[0].clientWidth-14)+'px'; 76 77 var imgE = document.createElement('img'); 78 imgE.src = 'images/locker.png'; 79 imgE.style.position = 'absolute'; 80 imgE.style.top = '1.7em'; 81 imgE.style.left = (inputs[0].clientWidth+4)+'px'; 82 83 inputs[0].parentNode.style.position = 'relative'; 84 inputs[0].parentNode.insertBefore(imgE,inputs[0].nextSibling); 85 86 var notes = getElementsByNameAndClass('p','form-note',loc[i]); 87 for (var j=0; j<notes.length; j++) { 88 notes[j].style.display = 'none'; 89 } 90 91 imgE.onclick = function() { 92 inputs[0].disabled = false; 93 this.style.display = 'none'; 94 inputs[0].style.width = (inputs[0].clientWidth+14)+'px'; 95 for (var j=0; j<notes.length; j++) { 96 notes[j].style.display = 'block'; 97 } 98 } 99 } 100 } 101 102 function helpWindow(url) 103 { 104 window.open(url,'dchelp', 105 'alwaysRaised=yes,dependent=yes,toolbar=no,height=420,width=380,'+ 106 'menubar=no,resizable=yes,scrollbars=yes,status=no'); 107 108 return false; 109 } 110 111 // 112 // ChainHandler, py Peter van der Beken 113 // 114 function chainHandler(obj, handlerName, handler) { 115 obj[handlerName] = (function(existingFunction) { 116 return function() { 117 handler.apply(this, arguments); 118 if (existingFunction) 119 existingFunction.apply(this, arguments); 120 }; 121 })(handlerName in obj ? obj[handlerName] : null); 122 }; 123 124 // 125 // On load 126 // 127 chainHandler(window,'onload',function() { 128 129 });
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 11:57:01 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |