jQuery: Color Picker - Change Background Color at Run Time

Here is my aspx code

  1. <%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="ColorPicker.aspx.cs"Inherits="CustomColorPicker_jQuery.ColorPicker"%>  
  2.     <!DOCTYPE html>  
  3.     <html xmlns="http://www.w3.org/1999/xhtml">  
  4.         <head runat="server">  
  5.             <title>jQuery: Color Picker</title>  
  6.             <link id="jquiCSS" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/ui-lightness/jquery-ui.css" type="text/css" media="all" />  
  7.             <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" type="text/javascript">  
  8.                 </script>  
  9.                 <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js" type="text/javascript">  
  10.                     </script>  
  11.                     <script src="Script/evol.colorpicker.js" type="text/javascript">  
  12.                         </script>  
  13.                         <link href="CSS/evol.colorpicker.css" rel="stylesheet" type="text/css" />  
  14.                         <script>  
  15.                             $(document).ready(function()  
  16.                              {  
  17.                                 $('#txtpickcolor1').colorpicker  
  18.                                 ({  
  19.                                     initialHistory: ['#ff0000''#000000''red']  
  20.                                 }).on('change.color', function(evt, color)   
  21.                                  {  
  22.                                     $('#div1').css('background-color', color);  
  23.                                 }).on('mouseover.color', function(evt, color)  
  24.                                 {  
  25.                                     if (color)  
  26.                                     {  
  27.                                         $('#div1').css('background-color', color);  
  28.                                     }  
  29.                                 });  
  30.                                 $('#txtpickcolor2').colorpicker  
  31.                                 ({  
  32.                                     initialHistory: ['#ff0000''#000000''red']  
  33.                                 }).on('change.color', function(evt, color)  
  34.                                 {  
  35.                                     $('#div2').css('background-color', color);  
  36.                                 }).on('mouseover.color', function(evt, color)   
  37.                                 {  
  38.                                     if (color)  
  39.                                     {  
  40.                                         $('#div2').css('background-color', color);  
  41.                                     }  
  42.                                 });  
  43.                                 $('#txtpickcolor3').colorpicker  
  44.                                 ({  
  45.                                     initialHistory: ['#ff0000''#000000''red']  
  46.                                 }).on('change.color', function(evt, color)  
  47.                                 {  
  48.                                     $('#div3').css('background-color', color);  
  49.                                 }).on('mouseover.color', function(evt, color)  
  50.                                  {  
  51.                                     if (color)  
  52.                                     {  
  53.                                         $('#div3').css('background-color', color);  
  54.                                     }  
  55.                                 });  
  56.                                 $('#txtpickcolor4').colorpicker  
  57.                                 ({  
  58.                                     initialHistory: ['#ff0000''#000000''red']  
  59.                                 }).on('change.color', function(evt, color)  
  60.                                 {  
  61.                                     $('#div4').css('background-color', color);  
  62.                                 }).on('mouseover.color', function(evt, color)   
  63.                                 {  
  64.                                     if (color)  
  65.                                     {  
  66.                                         $('#div4').css('background-color', color);  
  67.                                     }  
  68.                                 });  
  69.                             });  
  70.                         </script>  
  71.                         </head>  
  72.                         <body id="body" runat="server">  
  73.                             <form id="form1" runat="server">  
  74.                                 <table style="width: 100%; border: solid 5px blue;">  
  75.                                     <tr>  
  76.                                         <td style="text-align: center; background-color:deepskyblue; color:white; font-weight:bold; font-size:14pt;">Custom Color Picker using jQuery</td>  
  77.                                     </tr>  
  78.                                     </table>  
  79.                                     <table style="width: 100%; border: solid 2px gray;">  
  80.                                         <tr>  
  81.                                             <td style="width: 50%; height: 120px; border: solid 2px gray;">  
  82.                                                 <div id="div1" style="height: 200px;">  
  83.                                                     <asp:TextBoxID="txtpickcolor1" runat="server"></asp:TextBox>  
  84.                                                         <p> .NET Core is a set of runtime, library and compiler components. Microsoft uses these components in various configurations for device and cloud workloads. You can do the same for your app or service. </p>  
  85.                                                         <p> .NET Core is versatile in multiple scenarios, from client applications, across web, server workloads to mobile apps. With its "pay as you go" model, .NET Core can be adapted easily to perform great and provide a rich experience developing for each of these. </p>  
  86.                                                 </div>  
  87.                                              </td>  
  88.                                                         <td style="width: 50%; border: solid 2px gray;">  
  89.                                                             <div id="div2" style="height: 200px;">  
  90.                                                                 <asp:TextBoxID="txtpickcolor2" runat="server"></asp:TextBox>  
  91.                                                                     <p> Managed runtimes make code easy to write and guarantee safe execution. .NET Core manages memory with a garbage collector, compiles your code with a JIT compiler or ahead of time with .NET Native. </p>  
  92.                                                               <p> .NET Core is backed by an open ECMA standard that outlines all of its capabilities which can be used to make a new reference implementation. A lot of projects did exactly this, and there are various implementation out there, Mono and Unity being the most popular, non-Microsoft ones. </p>  
  93.                                                           </div>  
  94.                                                           </td>  
  95.                                         </tr>  
  96.                                         <tr>  
  97.                                             <td style="width: 50%; height: 120px; border: solid 2px gray;">  
  98.                                                 <div id="div3" style="height: 200px;">  
  99.                                                     <asp:TextBoxID="txtpickcolor3" runat="server"></asp:TextBox>  
  100.                                                         <p> You can create .NET Core apps that run on multiple OSes and CPUs. .NET Core runs on Windows. Ports are in progress for Linux, OS X and FreeBSD, as is integration with the LLVM compiler. </p>  
  101.                                                         <p> Runtime modularity allows for an extensibility model through a good set of abstractions for adding new components to the actual runtime and its class library, but also through its package manager NuGet, which allows for a powerful componentization strategies. </p>  
  102.                                                         </div>  
  103.                                                         </td>  
  104.                                                         <td style="width: 50%; border: solid 2px gray;">  
  105.                                                             <div id="div4" style="height: 200px;">  
  106.                                                                 <asp:TextBoxID="txtpickcolor4" runat="server"></asp:TextBox>  
  107.                                                             <p> .NET Core brings with it a set of languages, led by C#, with VB and F# with support for modern language features, like generics, Language Integrated Query (LINQ), async support and more. It is backed by a managed compiler called "Roslyn" that is exposed to the runtime, usable as a service. </p>  
  108.                                             
  109.                                                       <p> The managed runtime of .NET Core allows for a streamlined and easy interoperability with native code through several ways. Each of them allows for a rich set of scenarios not to mention great performance. </p>  
  110.                                                    </div>  
  111.                                               </td>  
  112.                                       </tr>  
  113.                              </table>  
  114.                        </form>  
  115.                    </body>  
  116.           </html>  
Here, I divided my web page in four sections:

page

page

page

page

page