码迷,mamicode.com
首页 > Web开发 > 详细

Js生成的彩色渐变条

时间:2015-05-20 12:48:04      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Js生成的彩色渐变条丨石家庄不锈钢旗杆</title>
    <script language="JavaScript1.2">
    <!--
    if (document.all){
    one=new Array();
    two=new Array();
    var a=10;var b=11;var c=12;var d=13;var e=14;var f=15;
    var width = 250;
    var height = 20;
    var gap = 5;
    var direction = 0;
    one[0]=f;
    one[1]=f;
    one[2]=0;
    two[0]=0;
    two[1]=c;
    two[2]=0;
    if(direction==0) var num = width / gap;
    if(direction==1) var num = height / gap;
    color2=new Array();
    color1=new Array();
    diff=new Array();
    for(i=0;i<3;i++) {
    diff[i] = two[i] - one[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();
    two[0]=0;
    two[1]=0;
    two[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(one[j]==a)document.write("a");
    if(one[j]==b)document.write("b");
    if(one[j]==c)document.write("c");
    if(one[j]==d)document.write("d");
    if(one[j]==e)document.write("e");
    if(one[j]==f)document.write("f");
    if(one[j]<10)document.write(one[j]);
    if(two[j]==a)document.write("a");
    if(two[j]==b)document.write("b");
    if(two[j]==c)document.write("c");
    if(two[j]==d)document.write("d");
    if(two[j]==e)document.write("e");
    if(two[j]==f)document.write("f");
    if(two[j]<10)document.write(two[j]);
    one[j] = one[j] + color1[j];
    two[j] = two[j] + color2[j];
    if(two[j]>15) {
    two[j] = two[j] - 15;
    one[j]++;
    }
    }
    if(direction==0) document.write(" width="+gap+" height="+height+">&nbsp;</td>);
    if(direction==1) document.write(" width="+width+" height="+gap+">&nbsp;</td></tr>);
    }
    document.write(</table>);
    }
    //-->
    </script>
    </head>
    <body>
    </body>
    </html>
    <br><br><hr>
    

 

Js生成的彩色渐变条

标签:

原文地址:http://www.cnblogs.com/zhaozzm/p/4516658.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!