Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Paleta kolorów
Forum PHP.pl > Forum > Po stronie przeglądarki > JavaScript
sajborg
Witam szukam czegos takiego ze mam inputa i che z boku palete kolorów jak to zrobic jak zrobic taka palete moze sa jakies gotowe skrypty a jesli sie nie da to wymyslilem cos takiego ze zrobie sobie scrrena palety wstawie i jak wstawic kolor z miejsca w obrazie w ktorym jest kursor
sajborg
Znalazlem cos innego przerobilem i działa biggrin.gif

  1. <script type="text/javascript" language="JavaScript">
  2. <!--
  3. function showColor(color) {
  4. document.getElementById("selectedColor").style.backgroundColor = color;
  5. document.getElementById("selectedColorBox").value = color;
  6. }
  7.  
  8. var colors = new Array(
  9. "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
  10. "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
  11. "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
  12. "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033",
  13. "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399",
  14. "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff",
  15. "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333",
  16. "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399",
  17. "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff",
  18. "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633",
  19. "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699",
  20. "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff",
  21. "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633",
  22. "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999",
  23. "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff",
  24. "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933",
  25. "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999",
  26. "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff",
  27. "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33",
  28. "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99",
  29. "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff",
  30. "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33",
  31. "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99",
  32. "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff",
  33. "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
  34. "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
  35. "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
  36. );
  37.  
  38. function renderColorMap() {
  39. var html = "";
  40.  
  41. html += '<table border="0" cellspacing="1" cellpadding="0">'
  42. + '<tr>';
  43. for (var i=0; i<colors.length; i++) {
  44. html += '<td bgcolor="' + colors[i] + '">'
  45. + '<a href="javascript:selectColor();" onfocus="showColor('' + colors[i] + '');" onmouseover="showColor('' + colors[i] + '');">'
  46. + '<img border="0" src="images/spacer.gif" width="10" height="10" title="' + colors[i] + '" alt="' + colors[i] + '" /></a></td>';
  47. if ((i+1) % 18 == 0)
  48. html += '</tr><tr>';
  49. }
  50. html += '<tr><td colspan="18">'
  51. + '<table width="100%" border="0" cellspacing="0" cellpadding="0">'
  52. + '<tr><td>'
  53. + '<img id="selectedColor" border="0" src="images/spacer.gif" width="80" height="16" />'
  54. + '</td><td align="right">'
  55. + '<input id="selectedColorBox" name="selectedColorBox" type="text" size="7" maxlength="7" style="width:65px" />'
  56. + '</td></tr>'
  57. + '</table>'
  58. + '<div style="float: left"><input type="button" id="insert" name="insert" value="{$lang_theme_colorpicker_apply}" style="margin-top:3px" onclick="selectColor();"></div>'
  59. + '<div style="float: right"><input type="button" name="cancel" value="{$lang_cancel}" style="margin-top:3px" id="cancel" /></div>'
  60. + '</td></tr>'
  61. + '</table>';
  62.  
  63. document.write(html);
  64. }
  65. //-->
  66. <div align="center">
  67. <script language="javascript" type="text/javascript">renderColorMap();</script>
  68. </div>
Speedy
To fajnie wygląda winksmiley.jpg

http://www.colourmod.com/
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.