表包含数字值,每个单元格都有自己的href
。
如果我这样应用hrefs:
nTd.click(function(e){
$(this).css("font-weight","bold");
e.stopPropagation();
location.href = 'http://google.com';
});
每次单击单元格重定向窗口时,都无法通过“ ctrl +单击”来打开新标签。
如果我要添加TD
类似的内容'<a href="http://google.com"> 123123 </a>'
,则对数字值进行排序会中断,按字典顺序。
检查一下事件发生时CTRL键是否按下:
nTd.click(function(e){
$(this).css("font-weight","bold");
e.stopPropagation();
if(e.originalEvent.ctrlKey){
window.open("http://www.google.com", "_blank");
} else {
location.href = 'http://google.com';
}
});
您不会在小提琴中看到页面更改,但是会看到它在控制台中产生的错误。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句