- #1
aheight
- 321
- 109
Hi,
I was wondering if someone could help me change the color of table check box labels when my HTML file is loaded. At run time, I load a JSON file with color data for each branch of a function I'm plotting via WebGL and display a table of check boxes one for each function branch (there can be many). I then give the reader the option of choosing which branches and rings of the function to display. I would like to color-code the check box text to the same color as the branch plot to make it easier for the reader to see which branch in the plot corresponds to which check box. In the <table> row below, I have for example, Branch 1 with id="testthis" and a label of "Branch 1". Suppose in my JSON file, I have the color of Branch 1 given by:
var branch1color=[165, 42,42];
which is brown. Ideally, I would like to switch out the "Branch 1" text to brown text via:
<font color="0xa52a2a">Branch 1</font> but when I try for example to use:
var mycolor=branch1color[[0]]*Math.pow(16,4)+myvalue[[1]]*Math.pow(16,2)+myvalue[[2]];
document.getElementById("testthis").textContent=mycolor.toString(16);
or some variation of that, I cannot get it to work.
Could someone help me with this please?
Thanks
I was wondering if someone could help me change the color of table check box labels when my HTML file is loaded. At run time, I load a JSON file with color data for each branch of a function I'm plotting via WebGL and display a table of check boxes one for each function branch (there can be many). I then give the reader the option of choosing which branches and rings of the function to display. I would like to color-code the check box text to the same color as the branch plot to make it easier for the reader to see which branch in the plot corresponds to which check box. In the <table> row below, I have for example, Branch 1 with id="testthis" and a label of "Branch 1". Suppose in my JSON file, I have the color of Branch 1 given by:
var branch1color=[165, 42,42];
which is brown. Ideally, I would like to switch out the "Branch 1" text to brown text via:
<font color="0xa52a2a">Branch 1</font> but when I try for example to use:
var mycolor=branch1color[[0]]*Math.pow(16,4)+myvalue[[1]]*Math.pow(16,2)+myvalue[[2]];
document.getElementById("testthis").textContent=mycolor.toString(16);
or some variation of that, I cannot get it to work.
Could someone help me with this please?
Thanks
HTML:
<tr>
<td class="branch1" id="testthis">
Branch 1
<input type="checkbox" id="ring1branch1"
checked="checked" name="branch1"/>
<td class="branch2">
Branch 2<input type="checkbox" id="ring1branch2"
checked="checked" name="branch2" />
<td class="branch3">
Branch 3<input type="checkbox" id="ring1branch3"
checked="checked" name="branch3" />
</tr>
Last edited: