Question

I've been using http://jscolor.com/ but I'm not getting one thing How can i take out the value of the color and paste it to value area in the form

I tried to put the script there but didn't work. How can i get +this.color into value area ?

<input value="" onchange="document.getElementsByTagName('BODY')[0].style.backgroundColor = '#'+this.color">
Était-ce utile?

La solution

Your code should work.... are you including:

<script type="text/javascript" src="jscolor/jscolor.js"></script>
<script>
    var bgColorPicker = new jscolor.color(document.getELementById('bgColorChanger'),{});
    document.getElementsByTagName('BODY')[0].style.backgroundColor = '#' + bgColorPicker.color";
    document.getElementByID('bgColorChanger').value = bgColorPicker.color;
</script>

before running the scripts?

<input id="bgColorChanger" value="" />

Will fill in the input value for you.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top