<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    顏色選擇器

    <HTML>
    <HEAD>
    <TITLE> 顏色拾取器 </TITLE>
    <style>
    body
    {
    margin:5px;
    background-color:menu;
    }

    fieldset
    {
    padding:3px;
    }

    body,a,table,div,span,td,th,input,select
    {
    font:9pt;
    font-family:Tahoma,Verdana, Arial, Helvetica, sans-serif;
    }
    </style>
    <script language="javascript">
    <!--
    var Size=18;var Palette=new Array();
    var SelectedColor=null;
    function Init216Colors()
    {
    var RGB=new Array("00","33","66","99","cc","ff");
    Palette=new Array();for(r=0;r<6;r++)
    {
    for(g=0;g<6;g++){for(b=0;b<6;b++){Palette[r*36+g*6+b]=new Array("#"+RGB[r]+RGB[g]+RGB[b],"#"+RGB[r]+RGB[g]+RGB[b]);};};};Palette[0][1]="black";Palette[5][1]="blue";Palette[30][1]="lime";Palette[35][1]="cyan";Palette[180][1]="red";Palette[185][1]="magenta";Palette[210][1]="yellow";Palette[215][1]="white";};
    function CreatePalette()
    {
    var objPalette=document.createElement("span");with(objPalette.style){fontSize=0;pixelWidth=Size*16;pixelHeight=Math.ceil(Palette.length/Size)*16;};objPalette.attachEvent("oncontextmenu",function(){return false;});objPalette.attachEvent("ondragstart",function(){return false;});document.getElementById('Palette').insertAdjacentElement("beforeEnd",objPalette);var objColorButton=document.createElement("span");with(objColorButton.style){fontSize=0;pixelWidth=pixelHeight=18;padding="1px";border="1px solid buttonface";backgroundColor="buttonface";};var objColorBox=document.createElement("span");with(objColorBox.style){fontSize=0;pixelWidth=pixelHeight=14;border="1px solid buttonshadow";};for(var i=0;i<Palette.length;i++){objColorButton.onmousemove=function(){DoMouseMove(this)};objColorButton.onmouseout=function(){DoMouseOut(this)};objColorButton.onmousedown=function(){DoMouseDown(this)};objColorButton.onmouseup=function(){DoMouseUp(this)};objColorBox.style.backgroundColor=Palette[i][0];objColorBox.title=Palette[i][1];objColorButton.appendChild(objColorBox);objPalette.appendChild(objColorButton);objColorButton=objColorButton.cloneNode();objColorBox=objColorBox.cloneNode();};};function DoMouseMove(btn){if(btn!=SelectedColor&&event.button==0){UpHover(btn);}else{DownHover(btn);};};function DoMouseOut(btn){if(btn!=SelectedColor){UpOut(btn);}else{DownOut(btn);};};function DoMouseDown(btn){with(btn.style){DownHover(btn);};};function DoMouseUp(btn){if(btn!=SelectedColor){if(SelectedColor!=null)UpOut(SelectedColor);SelectedColor=btn;};OK();};function UpHover(btn){with(btn.style){borderTopColor=borderLeftColor="buttonhighlight";borderBottomColor=borderRightColor="buttonshadow";backgroundColor="buttonface";};};function DownHover(btn){with(btn.style){borderTopColor=borderLeftColor="buttonshadow";borderBottomColor=borderRightColor="buttonhighlight";backgroundColor="buttonface";};};function UpOut(btn){with(btn.style){borderColor=backgroundColor="buttonface";};};function DownOut(btn){with(btn.style){borderTopColor=borderLeftColor="buttonshadow";borderBottomColor=borderRightColor="buttonhighlight";backgroundColor="whitesmoke";};};
    function OK()
    {
    var color=SelectedColor.firstChild.style.backgroundColor;
    window.returnValue=color;
    window.close();
    };
    function Cancel(){window.close();};function OKCustom(){var color=CustomColor.value;if(!CheckColor(color)){alert("顏色值不合法\r\n應(yīng)該類似如下形式 #FF8000 ");return;};window.returnValue=color;window.close();};function Clear(){var obj=window.dialogArguments;obj.value="";obj.nextSibling.style.backgroundColor='';window.close();};function Init(){Init216Colors();CreatePalette();};function CheckColor(str){var re=/^#[a-f0-9]{6}$/i;if(re.test(str)){return true;}else{return false;};};
    //-->
    </script>
    </HEAD>
    <BODY OnLoad="Init()" bgcolor=menu>
    <fieldset>
    <legend>216安全色</legend>
    <table align="center" border=0 cellspacing=0 cellpadding=0 style="font-size:12px;" onselectstart="return false;">
    <tr>
    <td align='left' id='Palette'></td>
    </tr>
    </table>
    </fieldset>

    <fieldset>
    <legend>自定義顏色</legend>
    <table width="100%" align="center" border=0 cellspacing=0 cellpadding=0>
    <tr><td align="center"><input id="CustomColor" type="text" size="10" value="" maxlength="7"> <input id="OKCustom" type="button" onClick="OKCustom()" value="確定"></input></td>
    </tr>
    </table>
    </fieldset>
    <table width="100%" border="0" cellspacing="0" cellpadding="5" align="center">
    <tr>
    <td align="center"><input type="button" value="清空" style="width:80px" onClick="Clear()"></td>
        <td align="center"><input type="button" value="取消" style="width:80px" onClick="Cancel()"></td>
    </tr>
    </table>

    </BODY>
    </HTML>


    文章來源:http://www.cnblogs.com/wangdetian168/archive/2008/09/18/1293474.html
    posted on 2010-09-29 13:28 sanmao 閱讀(250) 評(píng)論(0)  編輯  收藏

    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     

    常用鏈接

    留言簿(5)

    隨筆分類

    隨筆檔案

    搜索

    •  

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    主站蜘蛛池模板: avtt亚洲天堂| 国产成人久久AV免费| 亚洲国产精品美女久久久久| 亚洲国产精品成人精品软件| 亚洲无人区视频大全| 亚洲日本在线观看网址| 亚洲导航深夜福利| 亚洲国产av美女网站| 激情内射亚洲一区二区三区爱妻 | 久久久久国产精品免费免费不卡| 最近中文字幕免费大全| 免费在线黄色电影| 暖暖免费日本在线中文| 最近免费中文字幕高清大全| 国产精品久久永久免费| 青青青国产在线观看免费网站| 中文字幕无码免费久久99 | 国产高清对白在线观看免费91 | 亚洲乱码在线视频| 亚洲精品9999久久久久无码| jizzjizz亚洲日本少妇| 全黄A免费一级毛片| 任你躁在线精品免费| 久久久久久毛片免费播放| 0588影视手机免费看片| 成人毛片18女人毛片免费视频未| 免费无遮挡无码视频网站| 四虎免费永久在线播放| 国产亚洲一区二区三区在线不卡| 亚洲成AV人在线播放无码 | 亚洲第一网站男人都懂| 亚洲女同成av人片在线观看| 久久久久亚洲av无码专区| 亚洲人成网站999久久久综合| 免费VA在线观看无码| 玖玖在线免费视频| 成年人视频在线观看免费| 亚洲av无码国产精品色在线看不卡| 亚洲熟妇av一区二区三区| 亚洲精品资源在线| 精品久久久久久久久亚洲偷窥女厕|