1. | Get the .js file here. |
2. |
//------------------------------------------------------------------------------------------- // dHTML functions // // IE and Firefox compatible dHTML functions // © Copyright 2008 James McGowan (jamesweb 'at' bampotty 'dot' com) // // Not to be used without the author's permission. // //------------------------------------------------------------------------------------------- // usage : // // <script src="dHTML.js" type="text/javascript" language="javascript"></script> // // <script> // var a = new dHTML(); // var x = a.screenWidth(); // a.setXById("div1",200); // a.centerById("div2"); // if (a.isIE()) { alert("IE"); } else { alert("Firefox"); } // <script> // //------------------------------------------------------------------------------------------- // summary of methods // // .isIE() - true or false if the browser is IE or not. // .screenWidth() - available frame/window width in pixels // .screenHeight() - available frame/window height in pixels // .Div(name) - takes a name and retuns the div // .setX(div,px) - set the x-coordinate of a screen element // .setY(div,px) - set the y-coordinate of a screen element // .setXById(id,px) - set the x-coordinate of a screen element identified by ID // .setYById(id,px) - set the y-coordinate of a screen element identified by ID // .getX(div) - get the x-coordinate of a screen element // .getY(div) - get the y-coordinate of a screen element // .getXById(id) - get the x-coordinate of a screen element identified by ID // .getYById(id) - get the y-coordinate of a screen element identified by ID // .getWidth(div) - get the width of an element in pixels // .getHeight(div) - get the height of an element in pixels // .getWidthById(id) - get the width of an element identified by ID in pixels // .getHeightById(id) - get the height of an element identified by ID in pixels // .center(div) - centre a screen element on the available screen // .centerById(id) - centre a screen element identified by ID on the available screen // .createDiv(name,html) - creates a new floating div |