B
Bob
Hi,
When clicked into any cell of the table, i want to get the background color
of it. I can get the forecolor but not the bakground color (gives an empty
Alert, no error).
I think i can't change anything in the code-behind, so the error will be in
the javascript code ...
Thanks for your help
Bob
the aspx file:
-----------
<asp:Table ID="table1" runat="server"> </asp:Table>
<script language="javascript" type="text/javascript">
function tableclick(event)
{
forecl=window.event.srcElement.style.color
// this works
backcl=window.event.srcElement.style.background //
this not
alert(forecl)
alert(backcl)}
}
the code-behind:
----------------
'creattion of the cells in the table
Dim r As TableRow
Dim c(50, 20) As TableCell
For i = 0 To 50
r = New TableRow()
For j = 0 To 20
c(i, j) = New TableCell()
r.Cells.Add(c(i, j))
Next
Table1.Rows.Add(r)
Next
....
//e.g. the back/forecolor of cell 3,2:
c(3, 2).BackColor = System.Drawing.ColorTranslator.FromHtml("red")
c(3, 2).ForeColor = System.Drawing.ColorTranslator.FromHtml("yellow")
//c(3, 2).BackColor = Drawing.Color.Red
// tried also with this method
....
When clicked into any cell of the table, i want to get the background color
of it. I can get the forecolor but not the bakground color (gives an empty
Alert, no error).
I think i can't change anything in the code-behind, so the error will be in
the javascript code ...
Thanks for your help
Bob
the aspx file:
-----------
<asp:Table ID="table1" runat="server"> </asp:Table>
<script language="javascript" type="text/javascript">
function tableclick(event)
{
forecl=window.event.srcElement.style.color
// this works
backcl=window.event.srcElement.style.background //
this not
alert(forecl)
alert(backcl)}
}
the code-behind:
----------------
'creattion of the cells in the table
Dim r As TableRow
Dim c(50, 20) As TableCell
For i = 0 To 50
r = New TableRow()
For j = 0 To 20
c(i, j) = New TableCell()
r.Cells.Add(c(i, j))
Next
Table1.Rows.Add(r)
Next
....
//e.g. the back/forecolor of cell 3,2:
c(3, 2).BackColor = System.Drawing.ColorTranslator.FromHtml("red")
c(3, 2).ForeColor = System.Drawing.ColorTranslator.FromHtml("yellow")
//c(3, 2).BackColor = Drawing.Color.Red
// tried also with this method
....