|
藍森林 http://www.lslnet.com 2006年8月25日 8:28
求教關於淡入淡出的問題
目前正在做一個網站,其中有一幅圖片,對方要求在不同頁面中(點擊菜單以後),圖片不相同,並且要做到圖片能夠淡入的出現,淡出的消失,搞得我很頭痛。不知道怎麼實現它。我覺得可以做到圖片出現時的淡入效果,可淡出怎麼做,我實在不知道,查詢了一下,好像都是同一頁面上的淡入淡出效果,懇請大俠們指點一二。 |
你可以用OFFICE來實現它哦, |
用office?我不明白,您可以說得清楚一點嗎? |
我隨便改了一個程序給你,不知道是不是你想要的
[html]
<html>
<head>
<title>隨機漸顯圖片</title>
<head>
<meta http-equiv="Page-Enter" content="blendTrans(Duration=0.5)">
<meta http-equiv="Page-Exit" content="blendTrans(Duration=0.5)" >
<script language=JavaScript1.2>
function high(which){
theobject=which
highlighting=setInterval("highlightit(theobject)",50)
}
function low(which){
clearInterval(highlighting)
which.filters.alpha.opacity=25
}
function highlightit(that){
if (that.filters.alpha.opacity<100)
that.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}
</script>
</head>
<body >
<SCRIPT language="JavaScript"><!--
today=new Date();
jran=today.getTime();
function rnd() {
ia=9301;
ic=49297;
im=233280;
jran = (jran*ia+ic) % im;
return jran/(im*1.0);
};
function rand(number) {
return Math.ceil(rnd()*number);
};
document.write("<CENTER>");
for(i=1;i<=1;i++) {
myNum=(rand(5));
//please adjust the number here, the number "3" mean three pieces.
if(myNum == 1) document.write("<img src='http://www.blueidea.com/articleimg/game/logo/2005sdo/2005-8-17/246_s.jpg' ONMOUSEOUT=low(this) ONMOUSEOVER=high(this) STYLE='filter:alpha(opacity=50)' BORDER='0'>");
if(myNum == 2) document.write("<img src='http://www.blueidea.com/articleimg/game/logo/2005sdo/2005-8-23/1079_s.gif' ONMOUSEOUT=low(this) ONMOUSEOVER=high(this) STYLE='filter:alpha(opacity=50)' BORDER='0'>");
if(myNum == 3) document.write("<img src='http://pages.blueidea.com/articleimg/2005/09/1127/preview_s01.jpg' ONMOUSEOUT=low(this) ONMOUSEOVER=high(this) STYLE='filter:alpha(opacity=50)' BORDER='0'>");
if(myNum == 4) document.write("<img src='http://www.blueidea.com/articleimg/game/logo/2005sdo/2005-8-17/246_s.jpg' ONMOUSEOUT=low(this) ONMOUSEOVER=high(this) STYLE='filter:alpha(opacity=50)' BORDER='0'>");
if(myNum == 5) document.write("<img src='http://www.blueidea.com/articleimg/game/logo/2005sdo/2005-8-23/1274_s.gif' ONMOUSEOUT=low(this) ONMOUSEOVER=high(this) STYLE='filter:alpha(opacity=50)' BORDER='0'>");
//Add or Remove above sentences up to the pieces of BANNER. Something behind 「src」 is the save location of BANNER.
else {
document.write();
}
};
document.write("</CENTER>");
//-->
</SCRIPT>
</body>
</html>
[/html] |
多謝Hmilyheart,不過我需要的只是在圖片出現時是淡淡的,然後加深加深到正常的顏色。頁面更換時,淡淡的消失,然後出現另外一張圖片,也是淡淡的出現。我感覺是不是之能用flash做這樣的頁面呀? |
[html]
<script language="javascript"> <!--
mark=0;
function tupian() //建立函數tupian()
{
if(photo.filters.alpha.opacity<10)
//當圖片透明度小於10時
mark=1;
if(photo.filters.alpha.opacity>98)
//當圖片透明度大於98時
mark=-1;
step=2*mark;
photo.filters.alpha.opacity+=step;
//透明值計數器累加
setTimeout('tupian()',20);
//每隔20毫秒程序執行一次
}
---></script>
<img src="http://www.dfeng.cn/admin/pic/2005624121942222.jpg" id="photo"
style="filter:alpha(opacity=0;)">
<script><!--
tupian();
---></script>
[/html] |
多謝marvellous,我需要是淡入後不立刻淡出,而是在切換頁面的時候才淡出,能幫我想想辦法嗎? |
|