window.location的在新标签中打开
问题描述:
这里是我的代码,我使用,使整个DIV可点击:window.location的在新标签中打开
$(".clickablediv").click(function(){
window.location=$(this).find("a").attr("abc");
return false;
});
这种运作良好,但我希望链接在新标签中打开。我的代码正在寻找div中的超链接代码,其中添加了属性abc,并且必须保留此代码。但是,将其更改为window.open会失去可点击的div功能。
我怎样才能在新窗口中打开此链接?提前致谢。
答
尝试
window.open($(this).find("a").attr("abc"));
+1 - 也https://developer.mozilla.org/en/DOM/window.open见 – 2012-04-11 18:20:39
感谢Botanick,为我的作品。 – Vero44 2012-04-12 10:44:30