2 ------------------------------------------------------------------------------
3 X Library, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com).
4 Distributed under the terms of the GNU LGPL. This file contains contributor copyrights,
5 license information and documentation for a customized X library.
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 layout2or3_xlib.txt compiled with XC v0.22b for layout2or3_xlib.js
23 ------------------------------------------------------------------------------
24 globals, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com)
28 r2, ?, mf, added more sniffer vars
29 r1, 31Mar04, mf, put in it's own file for use with XC
33 The following global variables are available.
35 xVersion - X version string (in _header.js)
37 xUA - lowercase user-agent string
38 xIE4Up - true if browser is IE 4 or greater
39 xIE4 - true if browser is IE 4.x
40 xIE5 - true if browser is IE 5.x
41 xNN4 - true if browser is Netscape Navigator 4.x
42 xOp5or6 - true if browser is Opera 5.x or 6.x
43 xOp7 - true if browser is Opera 7.x
44 xMoz - true if browser is Mozilla, etc.
45 xMac - true if OS is Mac
47 For some browsers, the window resize and scroll events are simulated.
48 Some of the following variables may be used.
50 xPCW - previous clientWidth
51 xPCH - previous clientHeight
52 xREL - resize event listener
53 xPSL - previous scrollLeft
54 xPST - previous scrollTop
55 xSEL - scroll event listener
74 As much as possible, object-detection is used instead of browser-detection.
77 ------------------------------------------------------------------------------
78 xGetElementById, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com)
82 r1, 31Mar04, mf, put in it's own file for use with XC
93 ele - id string or object reference
107 ------------------------------------------------------------------------------
108 xStr, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com)
112 r1, 31Mar04, mf, put in it's own file for use with XC
126 Returns true if all its arguments are 'string' type.
137 ------------------------------------------------------------------------------
138 xScrollLeft, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com)
142 r2, ?, mf, added external window support
143 r1, 31Mar04, mf, put in it's own file for use with XC
154 ele - id string or object reference. If undefined return document scrollLeft.
158 Return the number of pixels the element (or window) has scrolled horizontally.
162 xGetElementById, xDef, xNum
170 ------------------------------------------------------------------------------
171 xScrollTop, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com)
175 r2, ?, mf, added external window support
176 r1, 31Mar04, mf, put in it's own file for use with XC
187 ele - id string or object reference. If undefined return document scrollTop.
191 Return the number of pixels the element (or window) has scrolled vertically.
195 xGetElementById, xDef, xNum
203 ------------------------------------------------------------------------------
204 xHeight, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com)
208 r3, 12Mar05, mf, Changed xSetCH to use xGetComputedStyle and removed xGetCS.
209 Made xSetCH inline. Reduces width/height funtions about 200 bytes.
210 r2, 14May04, mf, xHeight now accepts zero as valid
211 r1, 31Mar04, mf, put in it's own file for use with XC
215 Return and optionally set the element's height.
223 ele - id string or object reference
224 uH - unsigned integer height; it is rounded to an integer
231 xgetelementbyid, xnum, xdef, xstr, xgetcomputedstyle
239 ------------------------------------------------------------------------------
240 xClientWidth, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com)
244 r2, 27Jan05, mf, Moz update for xClientWidth/xClientHeight, check for 'CSS1Compat' (experimental?).
245 r1, 31Mar04, mf, put in it's own file for use with XC
271 ------------------------------------------------------------------------------
272 xClientHeight, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com)
276 r2, 27Jan05, mf, Moz update for xClientWidth/xClientHeight, check for 'CSS1Compat' (experimental?).
277 r1, 31Mar04, mf, put in it's own file for use with XC
303 ------------------------------------------------------------------------------
304 xAddEventListener, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com)
308 r2, 14Mar05, mf, reduced 136 bytes with shorter parameter names.
309 r1, 31Mar04, mf, put in it's own file for use with XC
313 Register an event listener on the element. For some browsers
314 the window.onscroll and window.onresize events are simulated.
318 xAddEventListener(ele, sEventType, fnEventListener[, bCapture])
322 ele - id string or object reference
323 sEventType - string event type ('mousemove', 'click', 'resize', etc.)
324 fnEventListener - reference to the listener function
325 bCapture - boolean capture event flag
333 xGetElementById, xIE4Up, xOp7,
334 xClientWidth, xClientHeight, xScrollLeft, xScrollTop
341 13Mar05, mf, The 2 sim events add a lot of weight - find a solution!!!
343 ------------------------------------------------------------------------------
344 xGetComputedStyle, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com)
348 r5, 14Mar05, mf, reduced by about 20 bytes
349 r4, 12Mar05, mf, return null on error
350 r3, ?, mf, added some error checking
351 r2, 23Aug04, mf, option to parseInt or return string
352 r1, 31Mar04, mf, put in it's own file for use with XC
356 For sProp use the css property name, not the object property name.
357 For finding width this works in Moz and Op, but in IE this only works
358 if padding and border use pixel units in the CSS.
362 xGetComputedStyle(oEle, sProp[, bInt])
366 oEle - element object
367 sProp - css property name
368 bInt - if true, return value is an integer
382 ------------------------------------------------------------------------------
383 xShow, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com)
387 r3, 27Jan05, mf, Bug-fixes for xShow/xHide (Dave/dlowther).
388 r2, ?, mf, changed to use xVisibility
389 r1, 31Mar04, mf, put in it's own file for use with XC
393 Set the element's visibility to 'visible' ('show' for NN4).
401 ele - id string or object reference
416 ------------------------------------------------------------------------------
417 xDef, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com)
421 r1, 31Mar04, mf, put in it's own file for use with XC
432 Can take any number and any type of arguments.
436 Return true if all arguments are defined.
447 ------------------------------------------------------------------------------
448 xNum, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com)
452 r2, 2Apr05, mf, also return false if isNaN, suggested by pgira at SPF
453 r1, 31Mar04, mf, put in it's own file for use with XC
467 Return true if all arguments are of type 'number', else false.
468 Also returns false if isNaN.
480 ------------------------------------------------------------------------------
481 xVisibility, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com)
489 Return and optionally set the element's visibility.
493 xVisibility(ele, bShow)
497 ele - id string or object reference
498 bShow - true = show, false = hide
505 xGetElementById, xDef