點擊顏色條生成顏色值
來源:易賢網 閱讀:801 次 日期:2016-06-30 09:39:28
溫馨提示:易賢網小編為您整理了“點擊顏色條生成顏色值”,方便廣大網友查閱!

js js獲取顏色,js顏色條,顏色條篩選,點擊顏色條獲取顏色值

從網上看到,自動選擇標題的顏色值,點擊顏色條某處,顯示該處顏色值

顏色條地址:顏色條地址

點擊中間顏色,該顏色值將出現在下框里。

<!doctype html public -//w3c//dtd xhtml 1.0 transitional//en >

<html xmlns=>

<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 align=middle>網站制作學習網</td>

</tr>

<tr>

<td id=111 valign=center align=middle>顏 色:</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代碼如下,www.forasp.cn網站制作學習網原創(chuàng),轉載請注明。

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;

}

更多信息請查看腳本欄目
易賢網手機網站地址:點擊顏色條生成顏色值

2025國考·省考課程試聽報名

  • 報班類型
  • 姓名
  • 手機號
  • 驗證碼
關于我們 | 聯(lián)系我們 | 人才招聘 | 網站聲明 | 網站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網安備53010202001879號 人力資源服務許可證:(云)人服證字(2023)第0102001523號
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關注公眾號:hfpxwx
咨詢QQ:1093837350(9:00—18:00)版權所有:易賢網