The problem is that you're appending the label to the checkbox
element, not the table cell, so when you are clicking on the checkbox,
you are clicking on both the checkbox AND the label, so it keeps its
current state.

Change the line:
vmc_box.appendChild(vmc_label);
to:
vmc_element.appendChild(vmc_label);
and it will work.  You may want to swap the order of appending the
label and the box, for consistency with the option above.

On Tue, Dec 29, 2009 at 10:14 PM, FractalBob <ruom...@gmail.com> wrote:
> Hi,
>
> My content script creates a checkbox OK, but when I try to manually
> change the state, nothing happens. Here's the code:
>
> var tables = document.getElementsByTagName("table");
> var checkbox_tbl = tables[tables.length - 2];
>
> var vmc_row = document.createElement("tr");
> vmc_row.vAlign = "top";
> var vmc_element = document.createElement("td");
>
> var vmc_box = document.createElement("input");
> vmc_box.id = "vmc";
> vmc_box.type = "checkbox";
> vmc_box.name = "vmc";
> vmc_box.checked = "checked";
>
> var vmc_label = document.createElement("label");
>
> vmc_label.appendChild(document.createTextNode
> ("\u00a0\u00a0\u00a0\u00a0Post\u00a0this\u00a0message\u00a0as
> \u00a0virtual\u00a0mail\u00a0content"));
> vmc_box.appendChild(vmc_label);
> vmc_element.appendChild(vmc_box);
> vmc_row.appendChild(vmc_element);
> checkbox_tbl.appendChild(vmc_row);
>
>
> Thanks.
>
> Bob
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Chromium-extensions" group.
> To post to this group, send email to chromium-extensi...@googlegroups.com.
> To unsubscribe from this group, send email to 
> chromium-extensions+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/chromium-extensions?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to chromium-extensi...@googlegroups.com.
To unsubscribe from this group, send email to 
chromium-extensions+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to