2

我的网站中有多个 ul(HTML 列表),该 ul 的结构如下:

<ul id="today_match_'+ counter +'_'+ today_counter +'" name= "today_group_'+counter+'" class="contests"><li id="'+page_url+'" class="fixture"><table class="fixture_table" border="1"><tr><td class="checkbox"><input type="checkbox" id="today_checkbox_'+ counter +'_'+ today_counter +'" class="checkbox"></td><td id="today_status_'+ counter +'_'+ today_counter +'" class="status" name="today_link_'+ counter +'_'+ today_counter +'">'+ status1 +'</td><td id="today_localteam_'+ counter +'_'+ today_counter +'" class="winner_localteam" name="today_link_'+ counter +'_'+ today_counter +'">'+ localteam +'</td><td id="today_goalsLocalteam_'+ counter +'_'+ today_counter +'" class="goals_localteam" name="today_link_'+ counter +'_'+ today_counter +'">'+ goals_localteam +'</td><td class="space" id = "'+static_id+'_'+ counter +'_'+ today_counter+'" name="today_link_'+ counter +'_'+ today_counter +'">-</td><td id="today_goalsVisitorteam_'+ counter +'_'+ today_counter +'" class="goals_visitorteam" name="today_link_'+ counter +'_'+ today_counter +'">'+ goals_visitorteam +'</td><td id="today_visitorteam_'+ counter +'_'+ today_counter +'" class="visitorteam" name="today_link_'+ counter +'_'+ today_counter +'">'+ visitorteam +'</td><td id="today_htScore_'+ counter +'_'+ today_counter +'" class="ht_score" name="today_link_'+ counter +'_'+ today_counter +'">'+ ht_score +'</td><td id="today_startTime_'+ counter +'_'+ today_counter +'" class="start_time" name="today_link_'+ counter +'_'+ today_counter +'"></td><td id="today_iddaaCode_'+ counter +'_'+ today_counter +'" class="iddaa_code" name="today_link_'+ counter +'_'+ today_counter +'"></td></tr></table></li></ul>

td 中的所有值都来自一个 xml 文件,每个 ul 都有一个 id、class 和 name。如果您注意到我在每个 ul 的 li 中有一个表,并且该表的第一个 td 是一个 checkbox 。现在,问题是每个 ul 都是我的实时比分网站中的一个固定装置,当我单击该 ul 时,我应该得到一个结果页面,但是当我将表的 Id 链接到 onclick 处理程序时,它会干扰单击复选框(我的意思是当我点击复选框时,链接被点击,当我点击链接时,复选框被选中)我无法为所有 td 制作内表,不包括复选框(由于 CSS 原因)所以我试图给出表的所​​有 td 的相同名称属性,不包括复选框的 td,并将​​它们与 onclick 链接,但它不起作用。我想知道这里是否有任何有用的方法?onclick 处理程序:

$("name[today_link_"+ counter +'_'+ today_counter+"]").click(function() {
                    testwindow = window.open(page_url, "mywindow", "location=1,status=1,scrollbars=1,width=800,height="+screen.height+",resizable=1");
                    testwindow.moveTo(0, 0);
                });
4

2 回答 2

0
$('input[name ="today_link_" + counter + "_" + today_counter ]').on('click', function() {
   dostuffhereboundonclick();
});

确保名称正确交叉引用(嵌套引号)。

于 2013-06-05T06:15:44.707 回答
0
$("input[name = today_link_"+ counter +"_"+ today_counter+"]).
于 2013-06-05T06:05:07.067 回答