vijayram 0 Newbie Poster

Hai everybody.
what is the problem

onclick javascript function not working
anybody plz help me.

function getColor(block)
{

var s_url=block.href;
var pColor=s_url.substr(s_url.indexOf("#"));

document.getElementById("colorText").style.backgroundColor=pColor;
document.getElementById("colorText").innerHTML=pColor;
}   


<img src="/images/palette.gif" usemap="#color_palette" />
          <map name="color_pallete" id="color_pallete" >
    <area shape="rect" coords="7,7,31,30" href="#003300" onclick="getcolor(this);return false" />
    <area shape="rect" coords="35,7,59,30" href="#003366" onclick="getColor(this);" />
    <area shape="rect" coords="63,7,87,31" href="#000080"  onclick="getColor(this);" />
    <area shape="rect" coords="92,7,115,31" href="#333399" onclick="getColor(this);" />
    <area shape="rect" coords="7,33,30,58" href="#008000"  onclick="getColor(this);"/>
    <area shape="rect" coords="36,34,59,57" href="#008080" onclick="getColor(this);" />
    <area shape="rect" coords="63,34,86,58" href="#0000ff" onclick="getColor(this);" />
    <area shape="rect" coords="92,35,115,57" href="#666699" onclick="getColor(this);" />
    <area shape="rect" coords="8,61,31,85" href="#339966"  onclick="getColor(this);" />
    <area shape="rect" coords="35,62,59,85" href="#33cccc" onclick="getColor(this);" />
    <area shape="rect" coords="64,61,86,85" href="#3366ff" onclick="getColor(this);" />
    <area shape="rect" coords="92,61,115,85" href="#800080"  onclick="getColor(this);" />
    <area shape="rect" coords="91,88,115,111" href="#993366" onclick="getColor(this);" />
    <area shape="rect" coords="64,88,87,111" href="#00ccff" onclick="getColor(this);" />
    <area shape="rect" coords="36,88,59,112" href="#00ffff" onclick="getColor(this);" />
    <area shape="rect" coords="8,88,30,111" href="#00ff00" onclick="getColor(this);" />
  </map>
<span id="colorText" name="" class="" style="height:50px;width:50px;display:block;">Your Text</span>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.