网站首页  汉语字词  英语词汇  考试资料  写作素材  旧版资料

请输入您要查询的考试资料:

 

标题 点击颜色条生成颜色值
内容
    js js获取颜色,js颜色条,颜色条筛选,点击颜色条获取颜色值
    从网上看到,自动选择标题的颜色值,点击颜色条某处,显示该处颜色值
    颜色条地址:颜色条地址
    点击中间颜色,该颜色值将出现在下框里。
    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>点击颜色条获取颜色值,</title>
    </head>
    <script src="js/color.js" type="text/javascript"></script>
    <body>
    <TABLE id=ColorPanel cellSpacing=0 cellPadding=0 border=0>
    <TBODY><TR>
    <TD id="111"  vAlign=center>网站制作学习网</TD>
    </TR>
    <TR>
    <TD id="111"  vAlign=center>颜 色:</TD>
    <SCRIPT language=JavaScript>rgb(pas,width1,height1)</SCRIPT>
    </TR>
    </TBODY>
    </TABLE>
    <table id="1" >
    <tr>
    <td><input type="text" name="abc" id="abc" /></td>
    </tr>
    </table>
    </body>
    </html>
    //js代码如下,。
    var height1 = 18;  // define the height of the color bar
    var pas = 36;  // define the number of color in the color bar
    var width1=1;      //forasp.cn
    var base_hexa = "0123456789ABCDEF";
    function dec2Hexa(number)
    { return base_hexa.charAt(Math.floor(number / 16)) + base_hexa.charAt(number % 16);}
    function RGB2Hexa(TR,TG,TB){return "#" + dec2Hexa(TR) + dec2Hexa(TG) + dec2Hexa(TB);}
    function lightCase(MyObject,objName){MM_findObj(objName).bgColor = MyObject.bgColor;}
    col = new Array;
    col[0] = new Array(255,0,255,-1,255,-1);
    col[1] = new Array(255,0,0,1,0,0);
    col[2] = new Array(255,-1,255,0,0,0);
    col[3] = new Array(0,0,255,0,0,1);
    col[4] = new Array(0,0,255,-1,255,0);
    col[5] = new Array(0,1,0,0,255,0);
    col[6] = new Array(255,-1,0,0,255,-1);
    function rgb(pas,w,h){
    for (j=0;j<6+1;j++){
    for (i=0;i<pas+1;i++){
    r = Math.floor(col[j][0]+col[j][1]*i*(255)/pas);
    g = Math.floor(col[j][2]+col[j][3]*i*(255)/pas);
    b = Math.floor(col[j][4]+col[j][5]*i*(255)/pas);
    codehex = r + '' + g + '' + b;//www.forasp.cn
    document.write('<td bgColor=\"' + RGB2Hexa(r,g,b) + '\" onClick=\"javascript:change_bg(this.bgColor);\" width=\"'+w+'\" height=\"'+h+'\"><IMG height='+h+' width='+w+' border=0 ></TD>\n');//网站制作学习网
    }
    }
    }
    function change_bg(bg)
    {
    document.getElementById("abc").value = bg;
    }
随便看

 

在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。

 

Copyright © 2002-2024 cuapp.net All Rights Reserved
更新时间:2025/5/17 3:32:19