Client side script

Y

Yama

Hi,

I have a datagrid with several columns and a single column containing a
checkbox. The grid has some client-side javascript and style sheet that
allows rollover change of row color.

I would like to add client-side script that would allow the user to click on
a row to check the checkbox and change the color of that row with performing
a trip back to my web server.

Any suggestions?

Yama
 
K

Karl

you can loop up the parentNode element of the checkbox 'til you hit a
row...something like (not tested)

<input type="checkbox" ...onClick="HighlightRow(this);">

function HighlightRow(checkbox){
if (!checkbox) return;
var parent= null;
for (parent= checkbox.parentNode; parent!= null && parent.TagName !=
'TR';parent= parent.parentNode){}
if (parent != null){
parent.style.background = (checkbox.checked) ? '#ff0000' : '#00ff00';
}
}

Karl
 
Y

Yama

Yes this is pretty much what I have. What I am trying to accomplish is when
the user clicks anywhere withing that row I want the behavior to select the
row as well as check the checkbox.

Any other suggestions?

Yama
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top