// 屬性設定
var E_strIFaderTransType = 'reveal'; // 'reveal' | 'blend'
var Filter_number = 23; // 濾鏡種數
var change_time = 3.000; // 濾鏡轉換過程為3.0秒延遲
var wait_time = 5000; // 兩種濾鏡之間為5秒延遲
var obj_Timer;
var count_temp = 0; //記錄目前是第幾幅圖檔
var Img_arry = new Array(); //圖檔數組
var E_ie4 = document.all?true:false;
var E_nn4 = document.layers?true:false;
function Filt_set() //設定濾鏡
{
if(!E_ie4 && !E_nn4) return;
if(E_ie4) {
var theImg = document.all['idImgFading'];
if(theImg == null) return;
with(document.all['idImgFading']) {
style.filter = (E_strIFaderTransType == 'reveal')?'revealTrans':'blendTrans';
style.filter.duration = change_time;
style.filter.transition = Filter_number;
}
}
use_Filter();
obj_Timer = window.setInterval('use_Filter()',wait_time);
}
function use_Filter() //濾鏡的啟動
{
if(E_ie4) {
with(document.all['idImgFading']) {
if(E_strIFaderTransType == 'reveal') {
filters(0).transition = Filter_number;
}
if(count_temp == (Img_arry.length - 1)) {
count_temp = -1;
}
count_temp++;
title = Img_arry[count_temp].sAlt;
parentElement.href = Img_arry[count_temp].command;
document.all['idImgLink'].innerText=title;
document.all['idImgLink'].href= Img_arry[count_temp].command;
filters(0).apply();
src = Img_arry[count_temp].sImgUrl;
filters(0).play();
}
}
else if(E_nn4) {
if(count_temp == (Img_arry.length - 1)) {
count_temp = -1;
}
count_temp++;
document.images['idImgFading'].src = Img_arry[count_temp].sImgUrl;
}
}
function obj_ClearTime() {
window.clearInterval(obj_Timer);
}
window.onunload = obj_ClearTime;//取消計時器,釋放系統資源
function Img_obj(sImgUrl,command,sAlt,sTarget)
{
this.sImgUrl = (sImgUrl == null)?'':sImgUrl;
this.command = (command == null || command == '')?'/':command;
this.sAlt = (sAlt == null)?'':sAlt;
this.sTarget = (sTarget == null || sTarget == '')?'_self':sTarget;
}
Img_arry[0] = new Img_obj('images/ldjy.jpg','DetailsPage.aspx','深入學習實踐科學發展觀活動動員大會','_self');
Img_arry[1] = new Img_obj('images/q3.jpg','link2.htm','3333333333333','_self');
調用方式:
<center>
<a><img alt="tp" hspace="0" src="images/q2.jpg" width="270" name="idImgFading" /></a><br/>
<a id="idImgLink"></a>
</center>
<script language="javascript" type="text/javascript">Filt_set();</script>