how to change the color of row ?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

how to change the color of row ?

Post by itsmani1 »

Code: Select all

<html>
<head>
<script language="javascript">
function checkAll()&#123;
	for (var i=0;i<document.forms&#1111;0].elements.length;i++)
	&#123;
		var e=document.forms&#1111;0].elements&#1111;i];
		if ((e.name != 'allbox') && (e.type=='checkbox'))
		&#123;
			e.checked=document.forms&#1111;0].allbox.checked;
		&#125;
	&#125;
&#125;
</script>
</head>

<body>
<form>
<table>
<input type="checkbox" value="on" name="allbox" onclick="checkAll();"/> Check all<br />

<h3>Fruit</h3>
<tr><td><input type="checkbox" value="on" name="apples" /> Apples<br/></td>
</tr>
<tr><td>
<input type="checkbox" value="on" name="oranges" /> Oranges<br/>
</td>
</tr>
<tr><td>
<input type="checkbox" value="on" name="bananas" /> Bananas<br/>
</td>
</tr>
</table>
</form>
</body>
</html>
see the above code !
what i want is : when a checkbox is checked, the color of the entire row changed to some other color

any help/hint plz.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

use an onchange event to switch the coloring for it's row. Give the row an id, that either you reference from the onchange call, or can derive from the checkbox object itself.

Moved to Client-side.
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

onChange="fex(){
Here comes the fxn defination !
var temp = color;
}

now problem is that how to use that color?
this is the thing i m looking for !
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

read up on how to dynamically set/change css values.. :roll:
Post Reply