Change row color when checkbox is checked

This is part of a table I have. People are running reports and they have about 50 rown, they check the box for the item they want to include in the report. I want to change the background color of the row if the checkbox is checked and clear it back to white if they uncheck it. This way its a very visual way of seeing what is included in the report.

Page is classic ASP/VBScript

--
<table width="100%"  class="tablesample" id="results">
 <tr>
                        <td><div align="center">
                          <input name="chk_status" type="checkbox" class="bodytext" id="chk_status">
                        </div></td>
                        <td>Status</td>
                        <td><span class="bodytext">
                          <input name="statuscont" type="radio" value="0" checked>
Active
<input name="statuscont" type="radio" value="1">
Archived
<input name="statuscont" type="radio" value="%">
All </span></td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <td><div align="center">
                          <input name="chk_type" type="checkbox" class="bodytext" id="chk_type">
                        </div></td>
                        <td>Type</td>
                        <td><span class="bodytext">
                          <input name="Contype" type="radio" value="1" checked>
Client
<input name="Contype" type="radio" value="0">
Prospect
<input name="Contype" type="radio" value="%">
All</span></td>
                        <td>&nbsp;</td>
                      </tr>
</table>

Open in new window

--

How can I do this ?  script ? css ?   Help is appreciated. We can use the example above. I assume I have to wrap the table row in a <div> then instruct the checkbox to change that specific row to change colors depending on its state ... :$
LVL 1
AleksAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
Hi,
a combination of both will do the trick.
Question: can you / are you willing to use the jQuery library?
That would make the scripting part much easier.
Thanks
Rainer
0
AleksAuthor Commented:
Sure, lets give it a shot :)
0
Rainer JeschorCommented:
Hi,
ok then please go to http://www.jquery.com and download an appropriate version.
Depending on your clients browser base either the latest 1.11.x version (for older browsers like IE 8) or the 2.x.y version (for newer browsers like IE10/11).

Then place the jquery file somewhere in your IIS site and add the following code (after adjusting the jquery path and file name) in the head section of your ASP page:
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$('#results').find('input:checkbox').click(function(){
			var isChecked = $(this).prop("checked");
			var $selectedRow = $(this).parent("td").parent("tr");
			if(isChecked) {
				$selectedRow.css({
					"background-color" : "black",
					"color" : "white"
				});
			} else {
				$selectedRow.css({
				   "background-color" : "white",
				   "color" : "black"
				});
			}
		});    
	});
</script>

Open in new window


HTH
Rainer
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AleksAuthor Commented:
I am using DW CC and already using some JQuery elements so the include should already be there :)
Let me try and get back to you in a couple hrs.
0
Big MontyWeb Ninja at largeCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.