By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,461 Members | 1,002 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,461 IT Pros & Developers. It's quick & easy.

Javascript needed to highlight a table cell dynamically

P: 32
Hi,

I am adding a table dynamically using c# as below:-

Expand|Select|Wrap|Line Numbers
  1. productCell = new TableCell();
  2. KSSCheckBox checkBox = new KSSCheckBox();
  3. checkBox.ID = string.Format("CheckBox|{0}|{1}", x, product.OwnProductUID);
  4. checkBox.Description = "Update";
  5. checkBox.Checked = false;
  6. checkBox.Attributes.Add("onClick", "HighLightCell();");
  7. productCell.Controls.Add(checkBox);
  8. productRow.Cells.Add(productCell);
When the user clicks the CheckBox I have to call a JS function which will highlight the table cell, and then do the reverse if the user unclicks the box again.

Trouble is I'm new to Javascript & dont really know where to start, have read plenty of examples on the Web but all of these are adding in at design time.

Any help will be appreciated.

Thx
Janet
Oct 16 '07 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
Once you have the checkbox, use parentNode to get the table cell and parentNode again to get the row.
Oct 16 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.