|
From: | Alan Langford |
Subject: | Re: SV: [Phpgroupware-developers] some strange beahviour with later updates of head |
Date: | Mon, 10 Apr 2006 08:20:37 -0400 |
User-agent: | Thunderbird 1.5 (Windows/20051201) |
When I first started pushing all my formatting into
style sheets, I would up with far too many styles, one for each
variation (like product, product_left, product_center, product_bold,
product_left_bold... and on). Then it dawned on me that the class
attribute refers to a list of styles, so you can make a
composite class. The tendency is then to have something like <td
class="product bold left">... which works, but really is about as
bad as encoding everything in a style. The form I now prefer is a list
of "formatting concepts", so I get <td
class="product column_head">, leaving "product" to select cell
styles and "column_head" to handle right-justification and bold. Maximum flexibility with minimal styles. Also on the subject of browser independence, you might find the following JS class useful. Feel free to integrate it with your code (with or without credit). // Web Browser Independence Library // // Author: Alan Langford // // This file creates a class that provides browser capability flags // and a browser-independent interface to common functions. // function WBIL() { this.isDOM = document.getElementById ? 1 : 0; this.isIE = document.all ? 1 : 0; this.isDHTML = this.isDOM || document.all; this.isOp = self.opera ? 1 : 0; this.isMac = navigator.platform.indexOf('Mac') != -1 ? 1 : 0; this.isWin = navigator.platform.indexOf('Win') != -1 ? 1 : 0; WBIL.prototype['getElement'] = document.all ? function(elem){return document.all[elem]} : function(elem){return document.getElementById(elem)}; WBIL.prototype['getWBIFlags'] = function() { // First segment in WBIF is version number return '1.' + this.isDOM + this.isIE + this.isDHTML; } WBIL.prototype['getHeight'] = window.innerHeight != null ? function(){return window.innerHeight} : function(){return document.body.clientHeight}; WBIL.prototype['getLeft'] = window.pageXOffset != null ? function(){return window.pageXOffset} : function(){return document.body.scrollLeft}; WBIL.prototype['getPosn'] = function (elem) { var x = 0,y = 0, w = 0, h = 0; elem = elem.substr ? this.getElement(elem) : elem; if (elem) { w = elem.clientWidth; h = elem.clientHeight; } var walk = elem; while(walk) { x += walk.offsetLeft; y += walk.offsetTop; walk = walk.offsetParent; } return {left : x, top : y, width: w, height : h}; } WBIL.prototype['getTop'] = window.pageYOffset != null ? function(){return window.pageYOffset} : function(){return document.body.scrollTop}; WBIL.prototype['getWidth'] = window.innerWidth != null ? function(){return window.innerWidth} : function(){return document.body.clientWidth}; } On 2006 04 10 05:51, Dave Hall wrote: On Mon, 2006-04-10 at 11:31 +0200, Sigurd Nes wrote:> document.all is IE only.Try <script type="text/_javascript_"> //<[CDATA[ /** * TODO Document function so others understand it :) */ function modplace(form) { if ( !document.getElementById ) { return false; // doesn't support DOM so bailout } var val = form.place_id.value; var div1 = document.getElementById('div1'); if(val == "new_place") { div1.style.display = 'block'; } else { div1.style.display = 'none'; } } //]]It worked (on both head and .16) - thanksno problem and enjoy :) Cheers Dave _______________________________________________ Phpgroupware-developers mailing list address@hidden http://lists.gnu.org/mailman/listinfo/phpgroupware-developers |
[Prev in Thread] | Current Thread | [Next in Thread] |