ATB Source Codes

Source of party and Government official open source Government TS version v1.0 Show selcolor.htm Source code

Return Download Source of party and Government official open source Government TS version v1.0: download selcolor.htm Source code - Download Source of party and Government official open source Government TS version v1.0 Source code - Type:.htm
  1. <HTML>
  2. <HEAD>
  3. <META content="text/html; charset=gb2312" http-equiv=Content-Type>
  4.  
  5. <STYLE type=text/css>
  6. TD {FONT-SIZE: 10.8pt}
  7. BODY {FONT-SIZE: 10.8pt}
  8. BUTTON {WIDTH: 5em}
  9. </STYLE>
  10.  
  11. <SCRIPT LANGUAGE=JAVASCRIPT SRC="dialog.js"></SCRIPT>
  12.  
  13. <SCRIPT language=JavaScript>
  14.  
  15.  
  16. var sAction = URLParams['action'] ;
  17. var sTitle = "";
  18. var color = "" ;
  19. var oSelection;
  20. var oControl;
  21. var sRangeType;
  22.  
  23. switch (sAction) {
  24.         case "forecolor":       // 字体前景色
  25.                 sTitle = "字体前景色";
  26.                 oSelection = dialogArguments.eWebEditor.document.selection.createRange();
  27.                 color = oSelection.queryCommandValue("ForeColor");
  28.                 if (color) color = N2Color(color);
  29.                 break;
  30.         case "backcolor":       // 字体背景色
  31.                 sTitle = "字体背景色";
  32.                 oSelection = dialogArguments.eWebEditor.document.selection.createRange();
  33.                 color = oSelection.queryCommandValue("BackColor");
  34.                 if (color) color = N2Color(color);
  35.                 break;
  36.         case "bgcolor":         // 对象背景色
  37.                 sTitle = "对象背景色";
  38.                 oSelection = dialogArguments.eWebEditor.document.selection.createRange();
  39.                 sRangeType = dialogArguments.eWebEditor.document.selection.type;
  40.                 if (sRangeType == "Control") {
  41.                         oControl = GetControl(oSelection, "TABLE");
  42.                 }else{
  43.                         oControl = GetParent(oSelection.parentElement());
  44.                 }
  45.                 if (oControl) {
  46.                         switch(oControl.tagName){
  47.                         case "TD":
  48.                                 sTitle += " - 单元格";
  49.                                 break;
  50.                         case "TR":
  51.                         case "TH":
  52.                                 sTitle += " - 表格行";
  53.                                 break;
  54.                         default:
  55.                                 sTitle += " - 表格";
  56.                                 break;
  57.                         }
  58.                         color = oControl.bgColor;
  59.                 }else{
  60.                         sTitle += " - 网页";
  61.                 }
  62.                 break;
  63.         default:                        // 其它颜色框
  64.                 if (URLParams['color']){
  65.                         color = decodeURIComponent(URLParams['color']) ;
  66.                 }
  67.                 break;
  68. }
  69.  
  70. document.write("<TITLE>颜色选择(" + sTitle + ")</TITLE>");
  71.  
  72. // 默认显示值
  73. if (!color) color = "#000000";
  74.  
  75. // 返回有背景颜色属性的对象
  76. function GetParent(obj){
  77.         while(obj!=null && obj.tagName!="TD" && obj.tagName!="TR" && obj.tagName!="TH" && obj.tagName!="TABLE")
  78.                 obj=obj.parentElement;
  79.         return obj;
  80. }
  81.  
  82. // 返回标签名的选定控件
  83. function GetControl(obj, sTag){
  84.         obj=obj.item(0);
  85.         if (obj.tagName==sTag){
  86.                 return obj;
  87.         }
  88.         return null;
  89. }
  90.  
  91. // 数值转为RGB16进制颜色格式
  92. function N2Color(s_Color){
  93.         s_Color = s_Color.toString(16);
  94.         switch (s_Color.length) {
  95.         case 1:
  96.                 s_Color = "0" + s_Color + "0000";
  97.                 break;
  98.         case 2:
  99.                 s_Color = s_Color + "0000";
  100.                 break;
  101.         case 3:
  102.                 s_Color = s_Color.substring(1,3) + "0" + s_Color.substring(0,1) + "00" ;
  103.                 break;
  104.         case 4:
  105.                 s_Color = s_Color.substring(2,4) + s_Color.substring(0,2) + "00" ;
  106.                 break;
  107.         case 5:
  108.                 s_Color = s_Color.substring(3,5) + s_Color.substring(1,3) + "0" + s_Color.substring(0,1) ;
  109.                 break;
  110.         case 6:
  111.                 s_Color = s_Color.substring(4,6) + s_Color.substring(2,4) + s_Color.substring(0,2) ;
  112.                 break;
  113.         default:
  114.                 s_Color = "";
  115.         }
  116.         return '#' + s_Color;
  117. }
  118.  
  119. // 初始值
  120. function InitDocument(){
  121.         ShowColor.bgColor = color;
  122.         RGB.innerHTML = color;
  123.         SelColor.value = color;
  124. }
  125.  
  126.  
  127. var SelRGB = color;
  128. var DrRGB = '';
  129. var SelGRAY = '120';
  130.  
  131. var hexch = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
  132.  
  133. function ToHex(n) {    
  134.         var h, l;
  135.  
  136.         n = Math.round(n);
  137.         l = n % 16;
  138.         h = Math.floor((n / 16)) % 16;
  139.         return (hexch[h] + hexch[l]);
  140. }
  141.  
  142. function DoColor(c, l){
  143.         var r, g, b;
  144.  
  145.         r = '0x' + c.substring(1, 3);
  146.         g = '0x' + c.substring(3, 5);
  147.         b = '0x' + c.substring(5, 7);
  148.  
  149.         if(l > 120){
  150.                 l = l - 120;
  151.  
  152.                 r = (r * (120 - l) + 255 * l) / 120;
  153.                 g = (g * (120 - l) + 255 * l) / 120;
  154.                 b = (b * (120 - l) + 255 * l) / 120;
  155.         }else{
  156.                 r = (r * l) / 120;
  157.                 g = (g * l) / 120;
  158.                 b = (b * l) / 120;
  159.         }
  160.  
  161.         return '#' + ToHex(r) + ToHex(g) + ToHex(b);
  162. }
  163.  
  164. function EndColor(){
  165.         var i;
  166.  
  167.         if(DrRGB != SelRGB){
  168.                 DrRGB = SelRGB;
  169.                 for(i = 0; i <= 30; i ++)
  170.                 GrayTable.rows(i).bgColor = DoColor(SelRGB, 240 - i * 8);
  171.         }
  172.  
  173.         SelColor.value = DoColor(RGB.innerText, GRAY.innerText);
  174.         ShowColor.bgColor = SelColor.value;
  175. }
  176. </SCRIPT>
  177.  
  178. <SCRIPT event=onclick for=ColorTable language=JavaScript>
  179.         SelRGB = event.srcElement.bgColor;
  180.         EndColor();
  181. </SCRIPT>
  182.  
  183. <SCRIPT event=onmouseover for=ColorTable language=JavaScript>
  184.         RGB.innerText = event.srcElement.bgColor;
  185.         EndColor();
  186. </SCRIPT>
  187.  
  188. <SCRIPT event=onmouseout for=ColorTable language=JavaScript>
  189.         RGB.innerText = SelRGB;
  190.         EndColor();
  191. </SCRIPT>
  192.  
  193. <SCRIPT event=onclick for=GrayTable language=JavaScript>
  194.         SelGRAY = event.srcElement.title;
  195.         EndColor();
  196. </SCRIPT>
  197.  
  198. <SCRIPT event=onmouseover for=GrayTable language=JavaScript>
  199.         GRAY.innerText = event.srcElement.title;
  200.         EndColor();
  201. </SCRIPT>
  202.  
  203. <SCRIPT event=onmouseout for=GrayTable language=JavaScript>
  204.         GRAY.innerText = SelGRAY;
  205.         EndColor();
  206. </SCRIPT>
  207.  
  208. <SCRIPT event=onclick for=Ok language=JavaScript>
  209.         color = SelColor.value;
  210.         if (!IsColor(color)){
  211.                 alert('无效的颜色值!');
  212.                 return;
  213.         }
  214.  
  215.         switch (sAction) {
  216.                 case "forecolor":
  217.                         dialogArguments.format('ForeColor', color) ;
  218.                         window.returnValue = null;
  219.                         break;
  220.                 case "backcolor":
  221.                         dialogArguments.format('BackColor', color) ;
  222.                         window.returnValue = null;
  223.                         break;
  224.                 case "bgcolor":
  225.                         if (oControl){
  226.                                 oControl.bgColor = color;
  227.                         }else{
  228.                                 dialogArguments.setHTML("<table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%'><tr><td valign=top bgcolor='"+color+"'>"+dialogArguments.getHTML()+"</td></tr></table>");
  229.                         }
  230.                         window.returnValue = null;
  231.                         break;
  232.                 default:
  233.                         window.returnValue = color;
  234.                         break;
  235.         }
  236.         window.close();
  237. </SCRIPT>
  238.  
  239. </HEAD>
  240.  
  241. <BODY bgColor=menu onload="InitDocument()">
  242. <DIV align=center>
  243. <CENTER>
  244. <TABLE border=0 cellPadding=0 cellSpacing=10>
  245. <TBODY>
  246. <TR>
  247. <TD>
  248. <TABLE border=0 cellPadding=0 cellSpacing=0 id=ColorTable style="CURSOR: hand">
  249. <SCRIPT language=JavaScript>
  250. function wc(r, g, b, n){
  251.         r = ((r * 16 + r) * 3 * (15 - n) + 0x80 * n) / 15;
  252.         g = ((g * 16 + g) * 3 * (15 - n) + 0x80 * n) / 15;
  253.         b = ((b * 16 + b) * 3 * (15 - n) + 0x80 * n) / 15;
  254.  
  255.         document.write('<TD BGCOLOR=#' + ToHex(r) + ToHex(g) + ToHex(b) + ' height=8 width=8></TD>');
  256. }
  257.  
  258. var cnum = new Array(1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0);
  259.  
  260. for(i = 0; i < 16; i ++){
  261.         document.write('<TR>');
  262.         for(j = 0; j < 30; j ++){
  263.                 n1 = j % 5;
  264.                 n2 = Math.floor(j / 5) * 3;
  265.                 n3 = n2 + 3;
  266.  
  267.                 wc((cnum[n3] * n1 + cnum[n2] * (5 - n1)),
  268.                 (cnum[n3 + 1] * n1 + cnum[n2 + 1] * (5 - n1)),
  269.                 (cnum[n3 + 2] * n1 + cnum[n2 + 2] * (5 - n1)), i);
  270.         }
  271.  
  272.         document.writeln('</TR>');
  273. }
  274. </SCRIPT>
  275.  
  276. <TBODY></TBODY></TABLE></TD>
  277. <TD>
  278. <TABLE border=0 cellPadding=0 cellSpacing=0 id=GrayTable style="CURSOR: hand">
  279. <SCRIPT language=JavaScript>
  280. for(i = 255; i >= 0; i -= 8.5)
  281. document.write('<TR BGCOLOR=#' + ToHex(i) + ToHex(i) + ToHex(i) + '><TD TITLE=' + Math.floor(i * 16 / 17) + ' height=4 width=20></TD></TR>');
  282. </SCRIPT>
  283.  
  284. <TBODY></TBODY></TABLE></TD></TR></TBODY></TABLE></CENTER></DIV>
  285. <DIV align=center>
  286. <CENTER>
  287. <TABLE border=0 cellPadding=0 cellSpacing=10>
  288. <TBODY>
  289. <TR>
  290. <TD align=middle rowSpan=2>选中色彩
  291. <TABLE border=1 cellPadding=0 cellSpacing=0 height=30 id=ShowColor width=40 bgcolor="">
  292. <TBODY>
  293. <TR>
  294. <TD></TD></TR></TBODY></TABLE></TD>
  295. <TD rowSpan=2>基色: <SPAN id=RGB></SPAN><BR>亮度: <SPAN
  296. id=GRAY>120</SPAN><BR>代码: <INPUT id=SelColor size=7 value=""></TD>
  297. <TD><BUTTON id=Ok type=submit>确定</BUTTON></TD></TR>
  298. <TR>
  299. <TD><BUTTON onclick=window.close();>取消</BUTTON></TD></TR></TBODY></TABLE></CENTER></DIV>
  300.  
  301. </BODY></HTML>
downloadselcolor.htm Source code - Download Source of party and Government official open source Government TS version v1.0 Source code
Related Source Codes/Software:
Sunzhuang town government - Simple and practical! 5.15KB
160 Shenzhen rental rental information network - Rental information network-a very good site, which... 79.99KB
Christmas blessings wishing wall - Christmas blessings wishing wall 3.56KB
ZerooneCMS v3.1 - A based on ASP.NET v2.0 of CMS, support Sql Server... 5.27KB
Zen Cart v1.3.0.2 Chinese Simplified version - Interface before and after culture in all, backgro... 15.93KB
Love agent shop navigation friendship China buffet chain V1.0 - Fully functional, application link, points into on... 4.34KB
Quanzhou China networks limited - Admin admin admin 21.45KB
Like webmaster forums - Administrator account: adminPassword: 86,552,4... 9.17KB
Journey of legends ASP.NET version system - Abbreviation for Cms is a Content Management Syste... 18.45KB
M media corporate website system v3.5.2 - M media on the powerful systems in addition to foc... 5.69KB
China source download System v1.0 - This 3-to beautify the program downloaded by the i... 5.26KB
Ganzhou Windows network - Cover feature:Windows Home | News vertical and... 34.61KB
Strains of strain of beautiful personal home page Build20061004 - -----------Modified part-------------1: added ... 7.7KB
Southwest agricultural information network - Southwest agricultural information network, an agr... 98.89KB
ZWMOBI 3G mobile station system - Powerful business modules, including mobile B2C mo... 3.89KB
As a campus site system v2.0 - For most school,, to built features powerful of ma... 44.88KB
Evening student seating system 7 - Evening student seating system is facilitated the ... 26.4KB
94KK be reluctant network community beautification bate3 (new year Edition) - Kernel KB 94kkBBS Forum, new landscaping, further ... 24.82KB
QQ Flash Word - 1. powerful DIY feature, which is now immeasurably... 67KB
Zoomla! Eall CMS v2.0 - Waves CMS is committed to providing our webmasters... 11.31KB

 Back to top