change text color on change of selection in dropdown list for each row
1 down vote favorite
I have a dropdown list of different colors on one row, and when list
selected, i would like to change a value of text color on that row to the
value of the selection. Each row have one field of dropdown list,
everytime user select dropdown list all the field on that will change the
same color. Thanks in advance,
<html>
<head>
<script type="text/javascript">
function updateTextColour(value) {
if (dropdownList.value > 0) {
dropdownList.style.color = 'red';
//document.body.style.color = '#' + value;
} }
</script>
<style type="text/css">.style1 {color: #FF0000;}</style
</head>
<body>
<form>Change the text color: <br>
<table>
<tr>
<td id="1" style="width:40px">1</td>
<td id="1" style="width:180px" class="style7">
<span class="style1"><span class="style1">
<select name="backGround" size="1"
onChange="updateTextColour(this.value);"><!--changeColor(this.selected);"-->
<option value="FF0400" style="color:red">[Red]</option>
<option value="05EF00" style="color:Green">[Green]</option>
<option value="0206FF" style="color:Blue">[Blue]</option>
<option value="000000" selected>[black]</option>
</select></span></span></td>
<td "width:auto" class="style8">Need to change to color row 1</td>
<br><br></tr>
<table>
<tr>
<td id="2" style="width:40px">2</td>
<td id="2" style="width:180px" class="style7">
<span class="style1"><span class="style1">
<select name="backGround2" size="1"
onChange="updateTextColour(this.value);"><!--changeColor(this.selected);"-->
<option value="000000">[Black]</option>
<option value="FF0400" style="color:red">[Red]</option>
<option value="EFE800" style="color:Yellow">[Yellow]</option>
<option value="05EF00" style="color:Green">[Green]</option>
<option value="0206FF" style="color:Blue">[Blue]</option>
<option value="FFFFFF" selected>[White]</option>
</select></span></span> </td>
<td "width:auto" class="style8">Need to change to color row 2</td>
</tr>
</table></table>
</form>
</body>
No comments:
Post a Comment