www.webdeveloper.com
Results 1 to 10 of 10

Thread: Text color

  1. #1
    Join Date
    Mar 2013
    Posts
    12

    Text color

    Hi,
    I need to add a color palette to my form so the user could select specific text inside a normal text box then choose a color from the palette.Please tell me how to do this.

  2. #2
    Join Date
    Mar 2013
    Posts
    12
    Please tell me how to make the color palette generating dynamically by using the div tags.

  3. #3
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    come on guy, stop asking and start searching...

  4. #4
    Join Date
    Mar 2013
    Posts
    12
    Ok I'd searched some code for the color palette. Now my issue is i want to show the color palette by clicking a image.Please tell me how to do this.

  5. #5
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,410
    If you really want some help, show what you have attempted thus far.
    This is a help forum, not a coding service.

  6. #6
    Join Date
    Mar 2013
    Posts
    12
    Code:
    <html>
    <head>
    
    <script type="text/javascript">
    function getColor1() { 
          var img = document.createElement("img");
          img.src = "img/palette.gif"; 
          //img.height = 75; 
          //img.width = 113;
          //img.style.top=800;
          //img.style.right=100;
          document.body.appendChild(img);
    	//getColor();
        }
    function getColor(block)
    {
    var s_url=block.href;
    var pColor=s_url.substr(s_url.indexOf("#"));
    document.getElementById("colorPalDemo").style.fontColor=pColor;
    getColor1();
    }
    
    
    
    </script>
    </head>
    <body>
            <img  src="img/supst.png" usemap="#color_pallete" onClick="getColor1();" />
    <map name="color_pallete" id="color_pallete">
        <area shape="rect" coords="7,7,31,30" href="#FF0000" onclick="getColor(this);" />
        <area shape="rect" coords="35,7,59,30" href="#00FF00" onclick="getColor(this);" />
        <area shape="rect" coords="63,7,87,31" href="#0000FF"  onclick="getColor(this);" />
        <area shape="rect" coords="92,7,115,31" href="#8B008B" onclick="getColor(this);" />
        <area shape="rect" coords="7,33,30,58" href="#00FFFF"  onclick="getColor(this);"/>
        <area shape="rect" coords="36,34,59,57" href="#006400" onclick="getColor(this);" />
        <area shape="rect" coords="63,34,86,58" href="#6B8E23" onclick="getColor(this);" />
        <area shape="rect" coords="92,35,115,57" href="#00FF7F" onclick="getColor(this);" />
        <area shape="rect" coords="8,61,31,85" href="#32CD32"  onclick="getColor(this);" />
        <area shape="rect" coords="35,62,59,85" href="#7FFFD4" onclick="getColor(this);" />
        <area shape="rect" coords="64,61,86,85" href="#7FFF00" onclick="getColor(this);" />
        <area shape="rect" coords="92,61,115,85" href="#008B8B"  onclick="getColor(this);" />
        <area shape="rect" coords="91,88,115,111" href="#9932CC" onclick="getColor(this);" />
        <area shape="rect" coords="64,88,87,111" href="#00BFFF" onclick="getColor(this);" />
        <area shape="rect" coords="36,88,59,112" href="#1E90FF" onclick="getColor(this);" />
        <area shape="rect" coords="8,88,30,111" href="#FF4500" onclick="getColor(this);" />
       </map>
    <span id="colorPalDemo"></span> 
      
    </body>
    </html>
    The above is my code. It doesn't works when the color is clicked.

  7. #7
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,410

    Exclamation

    We would need to have access to the 'supst.png' image to test your code.

    And, although I cannot test the premise, the 'href=#colors' assignments you make in the <area> tags
    is probably not valid as it normally would point to an HTML file to link to.
    Also the use of this in the onclick probably (???) needs to be something like this.color or something like that.

    Finally, you are changing the text of the font color in the id="colorPalDemo" element
    but you have no text to change color to, so nothing would visibly change.

  8. #8
    Join Date
    Mar 2013
    Posts
    12
    Actually no for text i'm trying to change the color. I am having a form ang i'm trying to include all these such as font name,size color etc to my form. If i click font name as times new roman and size as 10 and color as red and after selecting all these my tags will seen like <font name=times new roman size=10 color=#FF0000>hai<font>. The hai is my selected text in my textarea.

  9. #9
    Join Date
    Mar 2013
    Posts
    12
    Actually not for text i'm trying to change the color. I am having a form and i'm trying to include all these such as font name,size color etc to my form. If i click font name as times new roman and size as 10 and color as red and after selecting all these my tags will seen like <font name=times new roman size=10 color=#FF0000>hai<font>. The hai is my selected text in my textarea. Please tell me how to do that

  10. #10
    Join Date
    Mar 2013
    Posts
    12
    Thanks for the help. I have done what i expect. Now my problem is solved. Thanks again.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles