You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
3.4 KiB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <title>Really Simple Color Picker</title>
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  7. <script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  8. <script language="javascript" type="text/javascript" src="jquery.colorPicker.js"/></script>
  9. <script type="text/javascript">
  10. //Run the code when document ready
  11. $(function() {
  12. //use this method to add new colors to pallete
  13. //$.fn.colorPicker.addColors(['000', '000', 'fff', 'fff']);
  14. $('#color1').colorPicker();
  15. $('#color2').colorPicker();
  16. $('#color3').colorPicker({pickerDefault: "ffffff", colors: ["ffffff", "000000", "111FFF", "C0C0C0", "FFF000"], transparency: true});
  17. //fires an event when the color is changed
  18. //$('#color1').change(function(){
  19. //alert("color changed");
  20. //});
  21. $("#button1").click(function(){
  22. $("#color1").val("#ffffff");
  23. $("#color1").change();
  24. });
  25. $("#button2").click(function(){
  26. $("#color2").val("#000000");
  27. $("#color2").change();
  28. });
  29. });
  30. </script>
  31. <style type="text/css">
  32. /* styles adopted from Nidahas - Forms markup and CSS (http://nidahas.com/2006/12/06/forms-markup-and-css-revisited/) */
  33. /* General styles */
  34. body { margin: 0; padding: 0; font: 80%/1.5 Arial,Helvetica,sans-serif; color: #111; background-color: #FFF; }
  35. h2 { margin: 0px; padding: 10px; font-family: Georgia, "Times New Roman", Times, serif; font-size: 200%; font-weight: normal; color: #FFF; background-color: #CCC; border-bottom: #BBB 2px solid; }
  36. p#copyright { margin: 20px 10px; font-size: 90%; color: #999; }
  37. /* Form styles */
  38. div.form-container { margin: 10px; padding: 5px; background-color: #FFF; }
  39. p.legend { margin-bottom: 1em; }
  40. p.legend em { color: #C00; font-style: normal; }
  41. div.form-container div.controlset {display: block; float:left; width: 100%; padding: 0.25em 0;}
  42. div.form-container div.controlset label,
  43. div.form-container div.controlset input,
  44. div.form-container div.controlset div { display: inline; float: left; }
  45. div.form-container div.controlset label { width: 100px;}
  46. </style>
  47. <link rel="stylesheet" href="colorPicker.css" type="text/css" />
  48. </head>
  49. <body>
  50. <div id="wrapper">
  51. <h2>Really Simple Color Picker (jQuery)</h2>
  52. <p>More information about this can be found in <a href="http://laktek.com/2008/10/27/really-simple-color-picker-in-jquery/" title="Really Simple Color Picker in jQuery">this blog article</a>.</p>
  53. <div class="form-container">
  54. <form action="#" method="post">
  55. <fieldset>
  56. <div class="controlset"><label for="color1">Color 1</label> <input id="color1" type="text" name="color1" value="#333399" /></div>
  57. <div class="controlset"><label for="color2">Color 2</label> <input id="color2" type="text" name="color2" value="#FF0000" /></div>
  58. <div class="controlset"><label for="color3">Color 3 (customized with options)</label> <input id="color3" type="text" name="color3" value="#99cc00" /></div>
  59. </fieldset>
  60. <div class="buttonrow">
  61. <div><button type="button" id="button1">Set Color 1 to #FFF</button></div>
  62. <div><button type="button" id="button2">Set Color 2 to #000</button></div>
  63. </div>
  64. </form>
  65. </div>
  66. </body>
  67. </html>