Greetings!
I'm new to javascript and have a little problem requiring your expertise...
I've an asp repeater that generates an html table. When the tabe item is generated, I locate a particular row and cell. This works fine. For the cell, I create a 'onclick' javascript reference that also works
tdv.Attributes.Add("onclic
k", "ChangeColorOf(this)")
where tdv is defined as a htmltablecell
Dim tdv As HtmlTableCell
The javascript for this is
function ChangeColorOf(obj)
{
if (obj.style.backgroundColor
=='white')
{
obj.style.color = 'white';
obj.style.backgroundColor = 'green';
obj.innerHTML = '1';
}
else
{
obj.style.color = 'black';
obj.style.backgroundColor = 'white';
obj.innerHTML = '0';
}
}
The question... 'this' points to the table cell. Within the same table cell is a asp:textbox control. I'd like to have the asp:textbox, with it's visible attribute set to false and a label of 'tbnv', text value take on the value of the cell ( 1 or 0 ). Is this possible?
The reason I'm doing is simple. The textbox doesn't have a onclick event. The table cell has one through javascript. I want the user to simple click over the table cell to change to value from one to zero or zero to one with the hidden textbox taking on the value.
When, on the web page, the save button is selected, the table cell values, in the textbox can be referenced and saved. It's eith this approach or using asp:checkbox with postback to control background color. Unless javascript can be placed on the checkbox control to perform that function.
Your thoughts?
Allidap
Start Free Trial