Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > How to figure out on which row of a table I click e.g. a checkbox

Reply
Thread Tools

How to figure out on which row of a table I click e.g. a checkbox

 
 
Stefan Mueller
Guest
Posts: n/a
 
      01-23-2006
<form name = "my_form" action = "" method = "post" accept-charset =
"iso-8859-1">
<table name = "my_table" border = "1">
<tr>
<td>
<input type = "checkbox" onClick = "alert('Row 1');">
</td>
</tr>
<tr>
<td>
<input type = "checkbox" onClick = "alert('Row 2');">
</td>
</tr>
</table>
</form>

That works fine but I'd like to do it dynamically.

I tried
alert(document.my_form.my_table.row);
but it doesn't work (Error: document.my_form.my_table has no properties). I
think the problem is that <table> does not have a 'name' attribute.

Does anyone know how I can get the row dynamically?
Stefan


 
Reply With Quote
 
 
 
 
Travis Newbury
Guest
Posts: n/a
 
      01-23-2006
Stefan Mueller wrote:
> Does anyone know how I can get the row dynamically?


What is it you are "really" trying to accomplish? No one cares about
the row where you clicked. What are your "really" trying to do? Why
do you think you need the row?

 
Reply With Quote
 
 
 
 
Stefan Mueller
Guest
Posts: n/a
 
      01-23-2006
>> Does anyone know how I can get the row dynamically?
>
> What is it you are "really" trying to accomplish? No one cares about
> the row where you clicked. What are your "really" trying to do? Why
> do you think you need the row?


I wrote some Java Scripts to sort a html table.
The data are visible on the screen (html table) and are also stored in an
array. If I click now on a checkbox I need to now which row of my array
'array[row]' I have to modify (modify the flag of the checkbox). That's the
reason I need to know on which row I've clicked the checkbox.

Stefan


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
stumped...table - row - click event, cancel checkbox event dave ASP .Net Building Controls 0 09-02-2006 01:28 AM
row bottom border in inner table not matching up with row border in outer table phl HTML 1 06-08-2006 03:43 PM
Checkbox and dropdownlist row in repeater row =?Utf-8?B?UmljaGFyZEg=?= ASP .Net 2 03-24-2006 10:48 AM
How to figure out on which row of a table I click e.g. a checkbox Stefan Mueller Javascript 4 01-26-2006 05:35 PM
Cannot figure out where is the problem with code to add row Jack ASP General 3 01-04-2006 11:54 AM



Advertisments