473,320 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Table row background color change when button click

Hi,

Can anyone can tell me how to change a table row background color when I click a button? most of the tutorial I found add the event on the TR onclick event, but that not I want.

It is possible? I really appreciate any help.

can you give me a script

thanks in advance....

iceburn17
Sep 14 '06 #1
1 14846
I finally solve my problem, thank for the help, and now I want to share it with others; here are the script:

var preEl ;
var orgBColor;
var orgTColor;
function HighLightTR(backColor,textColor){
if(typeof(preEl)!='undefined') {
preEl.bgColor=orgBColor;
try{ChangeTextColor(preEl,orgTColor);}catch(e){;}
}

var el = event.srcElement;
if(el!='tr')
{
el = el.parentElement;
el = el.parentElement;
}
orgBColor = el.bgColor;
orgTColor = el.style.color;
el.bgColor=backColor;

try{ChangeTextColor(el,textColor);}catch(e){;}
preEl = el;
}

function ChangeTextColor(a_obj,a_color){ ;
for (i=0;i<a_obj.cells.length;i++)
a_obj.cells(i).style.color=a_color;
}

To use it just add it in the onclick event of the button.

Actually I find this script on the net, I just made some modification to it so that when I click a button it will change the color of the row. And also it will not work if your using image as your button, I don't know why, but if your using a regular button it will work fine.

I hope I may able to help someone....


iceburn17

Hi,

Can anyone can tell me how to change a table row background color when I click a button? most of the tutorial I found add the event on the TR onclick event, but that not I want.

It is possible? I really appreciate any help.

can you give me a script

thanks in advance....

iceburn17
Sep 15 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Jason Chan | last post by:
I have a cell in table with background color set to red, for example <table> <tr><td bgcolor="red">ABC</td></tr> </table> I print this page to a color printer, however, no background color is...
3
by: Roberto Castro | last post by:
Hello! I have been assigned for the first time an adp Access project and so far I have managed to make the changes needed for some requirements. However, I am struggling to find the place where...
5
by: Rik Brooks | last post by:
I am using a plain web forms button on an asp page - Is there any way to programatically change it to a custom color? -- ---------------------------------------- Magic is not in the hands of the...
6
by: Mark | last post by:
Hello all - I'm trying to incorporate a stylesheet into an ASP.Net page but everytime I include the "LINK" code to the .css file in the HEADER location of the HTML code, the background color that...
3
by: lovely_angel_for_you | last post by:
Hi, I have following link. By visitng first in IE, and then in Firefox, you would get to know my issue. http://lovely.angel.for.you.googlepages.com/test.htm...
7
by: lyealain | last post by:
hi... i have plenty of textbox containing the data... when the user update some of the textbox... how can i change the textbox become yellow to show that the data in that textbox has been updated... ...
5
by: ramadeviirrigireddy | last post by:
Hi All, I'm new to this group. I'm working on Java/J2ee. In my project i have one bricklet with header it will have some default color.But when mouseovers on this header i need to change the...
2
by: Stratocaster | last post by:
Hi all, I am having quite a time with Firefox. It refuses to display the background color of my table. I am at a loss as to why. I have validated the code and the errors were all in reference to the...
9
by: ghjk | last post by:
change the background image when Button Click ====================================== I' developing site with php and postgres. It has menus list in the left side. and all are images(jpg) EX:Add...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.