Page 1 of 1

how to change the color of row ?

Posted: Thu Feb 10, 2005 7:12 pm
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.

Posted: Thu Feb 10, 2005 7:21 pm
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.

Posted: Thu Feb 10, 2005 7:29 pm
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 !

Posted: Thu Feb 10, 2005 8:12 pm
by feyd
read up on how to dynamically set/change css values.. :roll: