control color :
In HTML5, we can have color input with simply . The textbox should only carry value of so called "simple color" string in lowercase such as #ff0000 for Red Color, #000000 for Black Color and #ffffff for White color. As of writing, the only web browser that support color input is Opera 11
| syntax | <input type="color" name="name" > |
example :
| Example | ||
|
<input type="color" name="favcolor" id="inputColor" >
: type color name
<br /> <input type="button" id="btn1" value="set color" onclick="changeColor()" /> <br /> <div id="MyDiv"> limanza.com </div> <script type="text/javascript"> function changeColor() { document.getElementById("MyDiv").style.backgroundColor = document.getElementById("inputColor").value; } </script> |
||
|
output : type your color name
limanza.com
|
||