此代码将href加载到一个新窗口并进入self,为什么会这样? 不应该返回虚假;停止默认点击?
//get links in paragraphs
var first_p = $$('#client_work p a');
//get first link
var client_link = first_p[0];
if(client_link) {
$(client_link).observe('click', function() {
var mylink = window.open(client_link.href, 'new_window', '_self');
return false;
})
}
答案 0 :(得分:3)
试试这个
//get links in paragraphs
var first_p = $$('#client_work p a');
//get first link
var client_link = first_p[0];
if(client_link) {
$(client_link).observe('click', function(event) {
var mylink = window.open(client_link.href, 'new_window', '_self');
Event.stop(event);
})
}