<script language="JavaScript1.2">
<!--
if
(document.all){
step1=new Array();
step2=new Array();
var a=10;
var
b=11;
var c=12;
var d=13;
var e=14;
var f=15;
//그라데이션 상자의 크기
var width = 350;
var height = 50;
//칼라와 칼라 사이의 부드러워지는 간격
var area = 5;
//0일경우 수평이며, 1일경우 수직
var direction = 0;
//칼라 코드 1
step1[0]=f;
step1[1]=f;
step1[2]=0;
//칼라 코드 2
step2[0]=0;
step2[1]=c;
step2[2]=f;
if(direction==0)
var num = width / area;
if(direction==1) var num = height /
area;
color2=new Array();
color1=new Array();
diff=new
Array();
for(i=0;i<3;i++) {
diff[i] = step2[i] - step1[i];
diff[i] =
diff[i] / num;
}
for(i=0;i<3;i++){
color1[i] = Math.round(diff[i] *
Math.pow(10, 0));
if(color1[i] > diff[i])color1[i] = color1[i] -
1;
color2[i] = diff[i] - color1[i];
color2[i] = color2[i] *
15;
color2[i] = Math.round(color2[i] * Math.pow(10, 0));
}
x=new
Array();
step2[0]=0;
step2[1]=0;
step2[2]=0;
document.write('<table
border="0" cellpadding="0" cellspacing="0" width="'+width+'"
height="'+height+'">');
if(direction==0)
document.write('<tr>');
for(i=0;i<=num;i++) {
if(direction==1)
document.write('<tr>');
document.write('<td
bgcolor="#');
for(j=0;j<3;j++)
{
if(step1[j]==a)document.write("a");
if(step1[j]==b)document.write("b");
if(step1[j]==c)document.write("c");
if(step1[j]==d)document.write("d");
if(step1[j]==e)document.write("e");
if(step1[j]==f)document.write("f");
if(step1[j]<10)document.write(step1[j]);
if(step2[j]==a)document.write("a");
if(step2[j]==b)document.write("b");
if(step2[j]==c)document.write("c");
if(step2[j]==d)document.write("d");
if(step2[j]==e)document.write("e");
if(step2[j]==f)document.write("f");
if(step2[j]<10)document.write(step2[j]);
step1[j]
= step1[j] + color1[j];
step2[j] = step2[j] +
color2[j];
if(step2[j]>15) {
step2[j] = step2[j] -
15;
step1[j]++;
}
}
if(direction==0) document.write('"
width="'+area+'" height="'+height+'"> </td>');
if(direction==1)
document.write('" width="'+width+'" height="'+area+'">
</td></tr>');
}
document.write('</table>');
}
//-->
</script>
댓글 쓰기 권한이 없습니다.
> | 표에 그라데이션 넣기 | 2009.09.05 |