VMax DHTML Lib v6.2

/*******************************************************
 * VMax DHTML Lib  v6.2                                *
 * (C)1996-2000   Virtual_Max  ( http://come.to/vmax ) *
 * This library and it's derivatives  is  free for use *
 * until this notice remains unchanged and  present in *
 * all copies and derivatives.                         *
 * revision: 09/12/2000                                *
 ******************************************************/

Cross browser DHTML library ready for all major browsers!

Tested with:
  Win2000 Win98 Win95 WinNT Linux Mac
Netscape 6.0 OK * OK * * *
Netscape 4.7 OK * OK OK OK(4.76) *
Netscape 4.6 OK * OK * * *
MIE 5.01 OK * OK * * *
MIE 4 - - OK - - -
* Help in testing on different platforms is greatly appreciated !! If you are looking through this page with a different Browser/OS combinations please let me know if it works for you or not. Please provide detailed browser/OS versions info and any problems that you noticed.


Important notice, please read carefully

I'm offering this library free for the web community, But this doesn't mean I'm offering free support for it !!!! I'm too busy to answer stupid questions and fix mistakes in your code for free. Sorry, I'm too busy with commercial projects.

Yes, it's absolutely free for ANY purpose if and only if the above notice remains unchanged in source code of the library. But if you like it and are willing to support my further work you are welcome to send me small gift. ( Who don't like gifts? )

Redistributing / mirroring of this library and it's description is strictly prohibited, I do not like idea of tons of obsolete versions distributed over the net. Instead you are welcome to provide a link to this page, where the latests version are always available. This resource home URL is:
http://www.oocities.org/virtual_max/vmaxdhtmllib6/index.html
If you have seen a copy of this page on another site, please report the URL of the site violating this rule.

Any bug reports for this library, test results and code fixes are welcome, e-mail it to virtual_max@oocities.com

More Java Scripts and Java Applets written by me (Virtual_Max) can be found at my site http://come.to/vmax

Virtual_Max


Download: RIGHT CLICK HERE and choose save link

function getById(id)

return DIV object with given ID. This function can also return image objects with NAME attribute. If the object is not found this function will return null.
Note: DIVs must have position CSS property defined in style. This function is used internally. This function is used internally.

Usage example

  var obj = getById('test1'); 
  alert('This description defined in '+(obj ? obj.id : 'Object not found')+' DIV');
Test it
Expected: alert with Text "This description defined in test1 DIV".

function Dimension(x,y,w,h)

constructor for Dimension object. Used internally by other functions. Dimension object is just a container for rectangle x,y,w,h properties.

Usage example

 var dim = new Dimension(10,20,200,100);
 alert(dim.x+', '+dim.y+', '+dim.w+', '+dim.h);
Test it
Expected: alert with text "10,20,200,100"

function getDivSizes(id)

function return Dimension object for DIV with given ID or null if object not found. Note: DIVs must have position property defined in style

Usage example

 var dim = getDivSizes('divSizes');
 alert(dim.x+', '+dim.y+', '+dim.w+', '+dim.h);
Test it
Note: as this div is defined with position:relative, then returned x and y are also relative, NN4 treats relative, as relative to current rendering position, so in NN4 this test will give x=0 and y=0, meanwhile MIE will return x and y relative to the top of the page.
For divs with position:absolute this function will return absolute coordinates.
Expected: alert with text reflecting x,y coordinates and width and height of this description div

function getViewPort()

function return Dimension object with position and sizes of rectangle of visible portion of document in vindow.

Usage example

 var dim = getViewPort();
 alert('You see rectangle ('+dim.x+', '+dim.y+', '+dim.w+', '+dim.h+') part of page');
Test it
Expected: alert with text reflecting x,y, width and height of page rectangular part visible inside this browser window (frame)

function getPageSize()

function return Dimension object with page width and height, x,y coordinates of this Dimension object is always (0,0)

Usage example

 var dim = getPageSize();
 alert('Page width='+dim.w+', Page height='+dim.h);
Test it

Expected: alert with text reflecting page total width and height

function showDiv(id,vis)

Shows/hides DIV with given ID depending on value of boolean vis parameter. If vis==true than div will be shown.
Note: Div must have position and visibility CSS properties defined in it's style.

Usage example

  showDiv('objectToShow',true);
  showDiv('objectToHide',false);
Test it
Expected: on mouseover/mouseout hide/show above function description

function moveDiv(id,x,y)

Move DIV with given ID to given coordinates
Note: Div must have position CSS property defined in it's style.

Usage example

  moveDiv('objectToMove',100,200);
Test it
Note: moveDiv works in terms of CSS position, if position is relative, then it moves in relative coordinate system, if absolute, than it performs an absolute move.
Expected: on mouseover move function description 20 pixels right, on mouseout move it back.

function setZindex(id, index)

Change zIndex of DIV with given ID.
Note: Div must have position and z-Index CSS properties defined in it's style.

Usage example

  setZindex('objectToChange',1000);
 
 
Test it

Expected: On mouseover/mouseout change zorder of above colored rectangles

function getZindex(id)

Return zIndex of DIV with given ID.
Note: Div must have position and z-Index CSS properties defined in it's style.

Usage example

  alert(getZindex('zTest'));
Test it

Expected: alert with text "100" ( zIndex of this function description )

function changeContent(id,content)

changes innerHTML of DIV/LAYER to new content
Note: Div must have position CSS property defined in it's style.

Usage example

   changeContent('testChange','This is new content for DIV')
Test content


Test it
Expected: On mouseover/mouseout Change original "Test content" to 'New content!' and back

©1996-2000 Virtual_Max (http://come.to/vmax)