gpt4 book ai didi

Javascript 打开新窗口并加载 _self

转载 作者:行者123 更新时间:2023-11-29 20:23:22 25 4
gpt4 key购买 nike

此代码将 href 加载到新窗口并加载到 self 中,这是为什么?不应返回 false;停止默认点击?

//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;

})
}

最佳答案

试试这个

//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);

})
}

关于Javascript 打开新窗口并加载 _self,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2678062/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com