Opacity.js
更新時(shí)間:2007年01月22日 00:00:00 作者:
復(fù)制代碼 代碼如下:
//---------------------------------------------------------------
// 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(div, strPath) {
this.layerObject = div;
this.path = strPath;
/* if (ns){
if (browserVersion>=5) {
this.layerObject = document.getElementById(divId).style;
} else {
this.layerObject = eval("document."+divId);
}
} else {
this.layerObject = eval(divId + ".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 div with the AlphaImageLoader, or with
// a standard image tag.
function od_displayImage(strId, strPath, intWidth, intHeight, strClass, strAlt) {
if (pngAlpha) {
document.write('<div style="height:'+intHeight+'px;width:'+intWidth+'px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+strPath+'.png\', sizingMethod=\'scale\')" id="'+strId+'" class="'+strClass+'"></div>');
} else if (pngNormal) {
document.write('<img src="students/%27%2BstrPath%2B%27.png" width="'+intWidth+'" height="'+intHeight+'" name="'+strId+'" border="0" class="'+strClass+'" alt="'+strAlt+'" />');
} else {
document.write('<img src="students/%27%2BstrPath%2B%27.gif" width="'+intWidth+'" height="'+intHeight+'" name="'+strId+'" border="0" class="'+strClass+'" alt="'+strAlt+'" />');
}
}
//---------------------------------------------------------------
//---------------------------------------------------------------
// OPACITY ROLL-OVER FUNCTIONS
function od_rollOver(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_rollOut(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 includes:
// -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 );
//---------------------------------------------------------------
相關(guān)文章
JavaScript數(shù)據(jù)結(jié)構(gòu)Number
這篇文章主要介紹了JavaScript數(shù)據(jù)結(jié)構(gòu)Number,Number?是JavaScript的基本數(shù)據(jù)結(jié)構(gòu),是對(duì)應(yīng)數(shù)值的應(yīng)用類型,下文給大家分享JavaScript使用?Number?的常見(jiàn)問(wèn)題,需要的朋友可以參考一下2022-02-02
利用js將ajax獲取到的后臺(tái)數(shù)據(jù)動(dòng)態(tài)加載至網(wǎng)頁(yè)中的方法
今天小編就為大家分享一篇利用js將ajax獲取到的后臺(tái)數(shù)據(jù)動(dòng)態(tài)加載至網(wǎng)頁(yè)中的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-08-08
JavaScript數(shù)組類型Array相關(guān)的屬性與方法詳解
這篇文章主要給大家介紹了關(guān)于JavaScript數(shù)組類型Array相關(guān)的屬性與方法的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-09-09
js實(shí)現(xiàn)視頻鏡面反轉(zhuǎn)的示例代碼
這篇文章主要為大家詳細(xì)介紹了如何利用JavaScript實(shí)現(xiàn)視頻鏡面反轉(zhuǎn)的效果,文中的示例代碼簡(jiǎn)潔易懂,感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2023-11-11
利用uni-app和uView實(shí)現(xiàn)多圖上傳功能全過(guò)程
最近在使用uniapp開(kāi)發(fā)的微信小程序中使用了圖片上傳功能,下面這篇文章主要給大家介紹了關(guān)于利用uni-app和uView實(shí)現(xiàn)多圖上傳功能的相關(guān)資料,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下2023-03-03
javascript中利用柯里化函數(shù)實(shí)現(xiàn)bind方法
這篇文章主要為大家詳細(xì)介紹了javascript中利用柯里化函數(shù)實(shí)現(xiàn)bind方法,感興趣的小伙伴們可以參考一下2016-04-04
用js閉包的方法實(shí)現(xiàn)多點(diǎn)標(biāo)注冒泡示例
這篇文章主要介紹了用js閉包的方法實(shí)現(xiàn)多點(diǎn)標(biāo)注冒泡,需要的朋友可以參考下2014-05-05
至2023年最好用的兼容多瀏覽器的原生js復(fù)制函數(shù)copyText
因?yàn)楹笈_(tái)需要增加一些復(fù)制一些內(nèi)容非表單中內(nèi)容,那么下面這個(gè)函數(shù)就非常的好用了,其實(shí)也是利用了表單的數(shù)據(jù)權(quán)限比較容易突破,下面是具體的實(shí)現(xiàn)函數(shù),大家可以拿走2023-05-05

