By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,550 Members | 2,757 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,550 IT Pros & Developers. It's quick & easy.

color of one <td> change by program when load - how?

P: n/a
Hello friends!

I am start my first ASP practic in VS2005.

**** My table ******************************
<table>
<tr>
<td></td>
</tr>
<tr>
<td style="background-color: #ccff66 ">TestColor</td>
</tr>
<tr>
<td></td>
</tr>
</table>

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

???
End Sub

*********************************************

How can I change color of one <td>TestColor</td> into other (random
different) when page load?

Please help me to start :)



Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
First you need to create an ID for your <td>
say <td id="tdTopCenter">TestColor</td>

create on onload event for your page
say <body onload="OnLoadEvent()">

Now create a method for the OnLoadEvent() and place it in the html header of
your page
<html>
....
<head>
....
<SCRIPT language="JavaScript">
function OnLoadEvent()
{
tdTopCenter.bgColor = TableCellColor.Value;
...
...
}
...
...
</SCRIPT>
....
</head>

You will need a hidden html server component "TableCellColor" on your aspx
page, which you can modify on the server side.
I think this should work, but you will have to test it yourself.

I hope this helps

MW
"Dmitry N.Ananyev" <dt****@relcom.ru> wrote in message
news:uP*************@TK2MSFTNGP12.phx.gbl...
Hello friends!

I am start my first ASP practic in VS2005.

**** My table ******************************
<table>
<tr>
<td></td>
</tr>
<tr>
<td style="background-color: #ccff66 ">TestColor</td>
</tr>
<tr>
<td></td>
</tr>
</table>

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

???
End Sub

*********************************************

How can I change color of one <td>TestColor</td> into other (random
different) when page load?

Please help me to start :)


Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.