[ Index ] |
|
Code source de Horde 3.1.3 |
1 /** 2 * Javascript object for hiding & showing DOM elements. 3 * 4 * $Horde: horde/js/hideable.js,v 1.2 2004/10/19 19:08:53 chuck Exp $ 5 * 6 * See the enclosed file COPYING for license information (LGPL). If you did not 7 * receive this file, see http://www.fsf.org/copyleft/lgpl.html. 8 */ 9 10 /** 11 * Constructor for Horde Hideable DOM elements. 12 * 13 * @param id The DOM id of the element we want to work with. 14 * @param displayStyle What display style shows this element? Defaults 15 * to 'block'. 16 */ 17 function Horde_Hideable() 18 { 19 this.id = arguments[0]; 20 this.element = document.getElementById(this.id); 21 22 if (arguments.length == 2) { 23 this.displayStyle = arguments[1]; 24 } 25 }; 26 27 Horde_Hideable.prototype = { 28 29 /** 30 * Id of the DOM element. 31 * @var id 32 */ 33 id: null, 34 35 /** 36 * DOM element reference. 37 * @var element 38 */ 39 element: null, 40 41 /** 42 * The display style to use. Default is 'block'. 43 * @var displayStyle 44 */ 45 displayStyle: 'block', 46 47 shown: function() 48 { 49 return this.element.style.display != 'none'; 50 }, 51 52 hide: function() 53 { 54 this.element.style.display = 'none'; 55 return this; 56 }, 57 58 show: function() 59 { 60 this.element.style.display = this.displayStyle; 61 return this; 62 }, 63 64 toggle: function() 65 { 66 return this.shown() ? this.hide() : this.show(); 67 } 68 69 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |