
正文
IE标签a嵌套table标签,链接点击无效
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
在IE中,使用如下代码将无法触发跳转:
<a href="http://xx.xx.com">
<table>
<tr>
<td>点击</td>
</tr>
</table>
</a>
a作为行内元素
而table是块级元素。
在IE 6、7、8、9中上面链接将无法生效。
js兼容处理
$("a:has(table)").bind("click", function() {
if (this.href.indexOf("javascript:") == 0) {
eval(this.href.replace(/^javascript:/, ""))
} else {
if (this.href.indexOf("#") != 0) {
if (this.target == "_blank") {
window.open(this.href)
} else {
location.href = this.href
}
}
}
});
不建议使用js兼容,建议修改结构






