Opacity. js? 1.1.23
The Code is as follows:
//---------------------------------------------------------------
// Opacity Displayer, Version 1.0.
// Copyright Michael Lovitt, 6/2002.
// Distribute freely, but please leave this notice intact.
//---------------------------------------------------------------
//---------------------------------------------------------------
// OPACITY OBJECT
//
// Instantiates the object, defines the properties and methods.
Function OpacityObject (p, strPath ){
This. layerObject = p;
This. path = strPath;
/* If (ns ){
If (browserVersion> = 5 ){
This. layerObject = document. getElementById (pId). style;
} Else {
This. layerObject = eval ("document." + pId );
}
} Else {
This. layerObject = eval (pId + ". style ");
}/**/
This. setBackground = od_object_setBackground;
}
// Uses AlphaImageLoader filter, or the css background property,
// As appropriate, to apply a PNG or GIF as the background of the layerObject.
Function od_object_setBackground (){
If (pngAlpha ){
This. layerObject. filter = "progid: DXImageTransform. Microsoft. AlphaImageLoader (src = '" + this. path + ". png', sizingMethod = 'Scale ')";
} Else if (pngNormal ){
If (browser. isMac & browser. isIE5up) this. layerObject. backgroundColor = '#999999 ';
Else this. layerObject. backgroundImage = 'url('{this.path}'.png )';
} Else {
This. layerObject. backgroundImage = 'url('{this.path}'.gif )';
}
}
//---------------------------------------------------------------
//---------------------------------------------------------------
// OPACITY DISPLAY FUNCTION
// Outputs the image as a p with the AlphaImageLoader, or
// A standard image tag.
Function od_displayImage (strId, strPath, intWidth, intHeight, strClass, strAlt ){
If (pngAlpha ){
Document. write ('
');
} Else if (pngNormal ){
Document. write ('');
} Else {
Document. write ('');
}
}
//---------------------------------------------------------------
//---------------------------------------------------------------
// Opacity roll-OVER FUNCTIONS
Function od_rolover (strId, strColor ){
If (pngAlpha ){
Document. getElementById (strId). style. backgroundColor = strColor;
} Else {
If (document. images & (flag = true )){
Document [strId]. src = eval (strId + "on. src ");
}
}
}
Function od_rolout (strId, strColor ){
If (pngAlpha ){
Document. getElementById (strId). style. backgroundColor = strColor;
} Else {
If (document. images ){
Document [strId]. src = eval (strId + "off. src ");
}
}
}
//---------------------------------------------------------------
//---------------------------------------------------------------
// Global variables
// If IE5.5 + on win32, then display PNGs with AlphaImageLoader
If (browser. isIE55 | browser. isIE6up) & browser. isWin32 ){
Var pngAlpha = true;
Var strExt = ". png ";
// Else, if the browser can display PNGs normally, then do that. that list nodes:
//-Gecko Engine: Netscape 6 or Mozilla, Mac or PC
//-IE5 + Mac (OpacityObject applies the background image at 100% opacity)
//-Opera 6 + PC
//-Opera 5 + Mac (doesn' t support dynamically-set background images)
//-Opera 6 + Linux
//-Omniweb 3.1 +
//-Icab 1.9 +
//-WebTV
//-Sega Dreamcast
} Else if (browser. isGecko) | (browser. isIE5up & browser. isMac) | (browser. isOpera & browser. isWin & browser. versionMajor> = 6) | (browser. isOpera & browser. isUnix & browser. versionMajor> = 6) | (browser. isOpera & browser. isMac & browser. versionMajor> = 5) | (browser. isOmniweb & browser. versionMinor> = 3.1) | (browser. isIcab & browser. versionMinor> = 1.9) | (browser. isWebtv) | (browser. isDreamcast )){
Var pngNormal = true;
Var strExt = ". png ";
// Otherwise, we use plain old GIFs
} Else {
Var strExt = ". gif ";
}
Var ns = (document. all )? False: true;
Var browserVersion = parseFloat (navigator. appVersion );
//---------------------------------------------------------------