There is a list, and you can select any position in the row to achieve:
1. Select the row to become highlighted
2. The radio button in the first column is also selected
Now the highlighting of this row is implemented, but the radio button is also selected but not. .
How to write js to achieve this?
Thanks in advance~
In the click event
onclick="xx(this)"
function xx(obj)
{
p = obj.parentNode
while(p.tagName!="TR") p=p.parentNode
}
p.cells[0].getElementsByTagName("input")[0].checked=true
In the click event
onclick="xx(this)"
function xx(obj)
{
p = obj.parentNode
while(p.tagName!="TR") p=p.parentNode
}
p.cells [0].getElementsByTagName("input")[0].checked=true
Thanks, that's basically it.
Because I set the onclick event on tr, I only need to write the following sentence:
obj.cells[0].getElementsByTagName("input")[0].checked = true;
Thank you very much~