JavaScript and client side scripting.
Moderator: General Moderators
itsmani1
Forum Regular
Posts: 791 Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:
Post
by itsmani1 » Thu Feb 10, 2005 7:12 pm
Code: Select all
<html>
<head>
<script language="javascript">
function checkAll(){
for (var i=0;i<document.formsї0].elements.length;i++)
{
var e=document.formsї0].elementsїi];
if ((e.name != 'allbox') && (e.type=='checkbox'))
{
e.checked=document.formsї0].allbox.checked;
}
}
}
</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.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Feb 10, 2005 7:21 pm
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.
itsmani1
Forum Regular
Posts: 791 Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:
Post
by itsmani1 » Thu Feb 10, 2005 7:29 pm
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 !
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Feb 10, 2005 8:12 pm
read up on how to dynamically set/change css values..