开发者

Table Row's onclick event should not affect only one Table data

I have a table in which all the rows are formed using a loop and all data are fo开发者_高级运维rmed using a inner loop. I have a onclick event for all the rows and the destination will differ, according to the row that is clicked. I want this onclick event for the entire row except the first TableData. How to use a javascript function that will disable the onclick event only for the first the first TableData?


You can do this with jsp as well. Here is how:

just before your loop put a counter variable and equalize it to 0. also before the loop put another variable called isfirst

now inside your loop, increment the counter var like counter++ after that run a condition like this:

if (counter == 1)
{
  isfirst = true;
}

Now where row is generated, put a condition that if it is first row, dont put the onclick event like this:

if (isfirst == true)
{
  // don't put onclick event for this row
}
else
{
  // put event for all other rows
}

NOTE: I don't know JSP, but you can mimic the code as shown above, thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜