打印

HTML 第九课:变色特效代码

HTML 第九课:变色特效代码

HTML 第九课:变色特效代码


画儿编写



代码解析:



共分四部分

第一部分定位

<TABLE style="LEFT: -0px; WIDTH: 1000px; POSITION: relative; TOP: 0px" cellSpacing=0 cellPadding=0 width=1000 align=center border=0>
<TBODY>
<TR>
<TD>
第二部分是图片代码
<IMG id=img1 height=1100 src="图片地址" width=1000> </TD></TR>

<TR>

第三部分flash代码
<EMBED style="LEFT: 100px; WIDTH: 600px; POSITION: absolute; TOP: 170px; HEIGHT: 830px" align=right src=flash地址 width=600 height=830 type=application/x-shockwave-flash quality="high" wmode="transparent">

<EMBED style="LEFT: 0px; WIDTH: 1000px; POSITION: absolute; TOP: 70px; HEIGHT: 830px" align=right src=flash地址 width=1000 height=830 type=application/x-shockwave-flash quality="high" wmode="transparent">

以下为变色特效部分

<SCRIPT language=JavaScript><!--
var bcolor="#ffffff"//
var numax=50;//
ccolor=new Array("#999999","#ccffff","#dd0000","#ff9900","#0000ff","#9cdc3d","#444444","#ff99ff"这些色码可根据自己喜欢的颜色调换);
img1.style.filter="progidXImageTransform.Microsoft.Light()"
iii=0
col="0123456789abcdef"
rr=col.indexOf(ccolor[0].substring(1,2))*16+col.indexOf(ccolor[0].substring(2,3));
gg=col.indexOf(ccolor[0].substring(3,4))*16+col.indexOf(ccolor[0].substring(4,5));
bb=col.indexOf(ccolor[0].substring(5,6))*16+col.indexOf(ccolor[0].substring(6,7));
eval("img1.filters['DXImageTransform.Microsoft.Light'].addAmbient("+rr+","+gg+","+bb+",100)")
iii=1
function changecolor(num,r,g,b){
if(num==0){
r=col.indexOf(ccolor[iii].substring(1,2))*16+col.indexOf(ccolor[iii].substring(2,3));
g=col.indexOf(ccolor[iii].substring(3,4))*16+col.indexOf(ccolor[iii].substring(4,5));
b=col.indexOf(ccolor[iii].substring(5,6))*16+col.indexOf(ccolor[iii].substring(6,7));
}
//status=num+","+((r-rr)*num/numax+rr)+","+((g-gg)*num/numax+gg)+","+((b-bb)*num/numax+bb)
eval("img1.filters['DXImageTransform.Microsoft.Light'].changecolor(0,"+((r-rr)*num/numax+rr)+","+((g-gg)*num/numax+gg)+","+((b-bb)*num/numax+bb)+",100)")
//eval("img1.filters['DXImageTransform.Microsoft.Light'].addAmbient("+((r-rr)*num/numax+rr)+","+((g-gg)*num/numax+gg)+","+((b-bb)*num/numax+bb)+",100)")
if(num<numax){
num=num+1;
setTimeout('changecolor('+num+','+r+','+g+','+b+')',100)
}else{
num=0;
rr=r;
gg=g;
bb=b;
iii=iii+1;
if(iii>ccolor.length-1) iii=0;
setTimeout('changecolor('+num+','+r+','+g+','+b+')',2000)
}
}
changecolor(0);
// -->
</SCRIPT>

第四部分:音乐代码。
<EMBED src=音乐地址 hidden=true type=audio/mpeg autostart="true" loop="true"></EMBED>
  伟大祖国是炎黄子孙最美丽的家园,五星红旗是我们家园最亮丽的一道风景,让我们共同祈愿:祖国明天更好!

TOP

变色特效代码的使用,按下列代码套用就可以了(数值部分可以调整)




<TABLE style="LEFT: -0px; WIDTH: 1000px; POSITION: relative; TOP: 0px" cellSpacing=0 cellPadding=0 width=1000 align=center border=0>
<TBODY>
<TR>
<TD>


<IMG id=img1 height=1100 src="图片地址" width=1000> </TD></TR>

<TR>

<EMBED style="LEFT: 100px; WIDTH: 600px; POSITION: absolute; TOP: 170px; HEIGHT: 830px" align=right src=flash地址 width=600 height=830 type=application/x-shockwave-flash quality="high" wmode="transparent">

<EMBED style="LEFT: 0px; WIDTH: 1000px; POSITION: absolute; TOP: 70px; HEIGHT: 830px" align=right src=flash地址 width=1000 height=830 type=application/x-shockwave-flash quality="high" wmode="transparent">



<SCRIPT language=JavaScript><!--
var bcolor="#ffffff"//
var numax=50;//
ccolor=new Array("#999999","#ccffff","#dd0000","#ff9900","#0000ff","#9cdc3d","#444444","#ff99ff");
img1.style.filter="progidXImageTransform.Microsoft.Light()"
iii=0
col="0123456789abcdef"
rr=col.indexOf(ccolor[0].substring(1,2))*16+col.indexOf(ccolor[0].substring(2,3));
gg=col.indexOf(ccolor[0].substring(3,4))*16+col.indexOf(ccolor[0].substring(4,5));
bb=col.indexOf(ccolor[0].substring(5,6))*16+col.indexOf(ccolor[0].substring(6,7));
eval("img1.filters['DXImageTransform.Microsoft.Light'].addAmbient("+rr+","+gg+","+bb+",100)")
iii=1
function changecolor(num,r,g,b){
if(num==0){
r=col.indexOf(ccolor[iii].substring(1,2))*16+col.indexOf(ccolor[iii].substring(2,3));
g=col.indexOf(ccolor[iii].substring(3,4))*16+col.indexOf(ccolor[iii].substring(4,5));
b=col.indexOf(ccolor[iii].substring(5,6))*16+col.indexOf(ccolor[iii].substring(6,7));
}
//status=num+","+((r-rr)*num/numax+rr)+","+((g-gg)*num/numax+gg)+","+((b-bb)*num/numax+bb)
eval("img1.filters['DXImageTransform.Microsoft.Light'].changecolor(0,"+((r-rr)*num/numax+rr)+","+((g-gg)*num/numax+gg)+","+((b-bb)*num/numax+bb)+",100)")
//eval("img1.filters['DXImageTransform.Microsoft.Light'].addAmbient("+((r-rr)*num/numax+rr)+","+((g-gg)*num/numax+gg)+","+((b-bb)*num/numax+bb)+",100)")
if(num<numax){
num=num+1;
setTimeout('changecolor('+num+','+r+','+g+','+b+')',100)
}else{
num=0;
rr=r;
gg=g;
bb=b;
iii=iii+1;
if(iii>ccolor.length-1) iii=0;
setTimeout('changecolor('+num+','+r+','+g+','+b+')',2000)
}
}
changecolor(0);
// -->
</SCRIPT>

<EMBED src=音乐地址 hidden=true type=audio/mpeg autostart="true" loop="true"></EMBED>

  伟大祖国是炎黄子孙最美丽的家园,五星红旗是我们家园最亮丽的一道风景,让我们共同祈愿:祖国明天更好!

TOP