Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 13th, 2007, 12:45 AM
Authorized User
 
Join Date: Mar 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Checking a checkbox on click of a row in a table

Hi,
How to check a checkbox added in a table by clicking anywhere in the table row?

------------------------------------------------------------------------------------------------------------
Adventure, Play, Alive, Fast, Race, Addict, React, Attack, Heat, Aggression, Blast, Ahead, Escape, Challenge, Anarchy, Game, Real, Damage, Insane, Acclerate,Passion, Fear, Dominate, Crazy, Awesome, Sweat, Habit, Avenge, Balls, Imagine, Viril, Chaos, Amuse, Heavy, Panic, @#!%, Fanatic
__________________
------------------------------------------------------------------------------------------------------------
<b><i>Adventure, Play, Alive, Fast, Race, Addict, React, Attack, Heat, Aggression, Blast, Ahead, Escape, Challenge, Anarchy, Game, Real, Damage, Insane, Acclerate,Passion, Fear, Dominate, Crazy, Awesome, Sweat, Habit, Avenge, Balls, Imagine, Viril, Chaos, Amuse, Heavy, Panic, @#!%, Fanatic </i></b>
 
Old January 13th, 2007, 11:56 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

You could add an onclick handler to the tr, passing the id of the checkbox:
Code:
<tr onclick="checkCheckbox('checkbox1');">
then have a function such as:
Code:
function checkCheckbox(checkboxId)
{
  var chk = document.getElementById(checkboxId);
  if (chk) chk.checked = true;
}
--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Infragistic Grid Loses control by row click madhavan ASP.NET 1.0 and 1.1 Professional 2 April 29th, 2008 01:28 AM
DGV CheckBox Click Issue obrienkev C# 2005 1 December 17th, 2007 06:04 AM
Enabling form elements on click of checkbox Shuchik Classic ASP Basics 2 September 12th, 2007 02:53 AM
In datagrid when checkbox true delete in btn click ashish2001mca ASP.NET Espanol 1 January 9th, 2006 08:45 AM
checking which checkbox checked MuthuAL Classic ASP Databases 5 February 1st, 2005 05:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.