Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/445.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 获取并搜索悬停的链接URL“;只有";_Javascript_Jquery_Mouseevent_Mouseover_Mouselistener - Fatal编程技术网

Javascript 获取并搜索悬停的链接URL“;只有";

Javascript 获取并搜索悬停的链接URL“;只有";,javascript,jquery,mouseevent,mouseover,mouselistener,Javascript,Jquery,Mouseevent,Mouseover,Mouselistener,顾名思义 「获取并搜索悬停链接URL“仅限”」 要做到这一点,需要进行哪些纠正 // Pattern1⃣ Malfunction // ① Opens all URLs that contain the specified word, regardless of mouse over target. // ② Opens with or without mouseover. var ele = document.querySelectorAll(".centerarticle-entr

顾名思义


「获取并搜索悬停链接URL“仅限”」

要做到这一点,需要进行哪些纠正

// Pattern1⃣ Malfunction
// ① Opens all URLs that contain the specified word, regardless of mouse over target.
// ② Opens with or without mouseover.
var ele = document.querySelectorAll(".centerarticle-entry-title a");
var link = ['Loading...', 'Dance Party'];
var L = window.onload = function(load) {
    window.addEventListener('keydown', (e) => {
        if (e.ctrlKey && e.keyCode === 13) { // CTRL + ENTER
            for (let i = 0; i < ele.length; i++) {
                for (let j = 0; j < link.length; j++) {
                    if (!link.onmouseenter) {
                        e.stopPropagation();
                    }
                    if (ele[i].innerHTML.match(link[j])) {
                        ele[i].innerHTML.match(link[j]).onmouseenter = window.open("https://web.archive.org/web/" + ele[i].href);
                        L = undefined;
                        ele[i].onmouseenter = undefined;
                        ele[i].onmouseenter = null;
                    }
                }
            }
        } else {
            ele[i].onmouseleave = e.preventDefault();
            return false;
        }
    });
};
//模式1⃣ 故障
// ① 打开包含指定单词的所有URL,而不考虑鼠标悬停在目标上。
// ② 可在有或无鼠标悬停的情况下打开。
var ele=document.queryselectoral(“.centerarticle条目标题a”);
var link=['Loading…','Dance Party'];
var L=window.onload=函数(加载){
window.addEventListener('keydown',(e)=>{
如果(e.ctrlKey&&e.keyCode==13){//CTRL+ENTER
for(设i=0;i
在模式1的情况下⃣, 这在另一个意义上是实用和方便的,但是我们这次想要实现的功能与Pattern1不同⃣.

您想要实现的功能是
「获取并搜索悬停链接URL“仅限”」 我对此很挑剔

我已经创建了一些其他原型,但它们更不实用,因为模式1的版本⃣ 甚至更糟,或者搜索结果是空的

// Pattern2⃣ Malfunction
// ① Opens all URLs that contain the specified word, regardless of mouse over target.
// ② There is a 'case' that opens even if you don't mouse over.
// ③ In some cases, nothing responds in the first place, in which case you need to do a super reload etc. each time.
// ④ The number of times you pressed the ENTER key to the sky may have accumulated. Alternatively, the number of hovering times can be accumulated as it is. That possibility can open duplicate TABs unnecessarily.
var ele = document.querySelectorAll(".centerarticle-entry-title a");
var link = ['Loading...', 'Dance Party'];
document.addEventListener('mouseenter', (m_enter) => {
    document.addEventListener('mouseleave', (m_leave) => {
        m_enter.preventDefault();
        e.preventDefault();
        return false;
    });
    window.addEventListener('keydown', (e) => {
        if (!(e.ctrlKey && e.keyCode == 13)) {
            m_enter.preventDefault();
            return false;
        }
        if (e.ctrlKey && e.keyCode == 13) {
            for (let i = 0; i < ele.length; i++) {
                for (let j = 0; j < link.length; j++) {
                    if (ele.innerHTML.match(link[j])) {
                        link[j].onmouseover = window.open("https://web.archive.org/web/" + ele[i].href);
                        location.reload();
                        break;
                    }
                }
            }
        } else {
            return false;
        }
    });
});


// Pattern3⃣ Malfunction
// ① Opens only one (probably top) URL that contains the specified word, regardless of whether you hover your mouse over the target.
// ② Opens with or without mouseover.
var ele = document.querySelectorAll(".centerarticle-entry-title a");
var link = ['Loading...', 'Dance Party'];
window.addEventListener('keydown', (e) => {
    if (e.ctrlKey && e.keyCode === 13) { // CTRL + ENTER key
        for (let i = 0; i < ele.length; i++) {
            for (let j = 0; j < link.length; j++) {
                if (ele[i].innerHTML.match(link[j])) {
                    link[j].onmouseover = window.open(("https://web.archive.org/web/" + ele[i].href));
                    return false;
                }
            }
        }
    }
});


// Pattern4⃣ Malfunction
// ① Opens with or without mouseover.
// ② Search results are empty or "undefined"
var ele = document.querySelectorAll(":hover");
var link = ['Loading...', 'Dance Party'];
window.addEventListener('keydown', (e) => {
    if (e.ctrlKey && e.keyCode == 13) {
        link.onmouseenter =
            window.open("https://web.archive.org/web/" + this.href);
        return false;
    }
});
//模式2⃣ 故障
// ① 打开包含指定单词的所有URL,而不考虑鼠标悬停在目标上。
// ② 有一个“案例”即使你没有鼠标悬停也会打开。
// ③ 在某些情况下,首先没有任何响应,在这种情况下,您需要每次执行超级重新加载等操作。
// ④ 按ENTER键进入天空的次数可能已累积。或者,可以按原样累积悬停次数。这种可能性可能会不必要地打开重复的选项卡。
var ele=document.queryselectoral(“.centerarticle条目标题a”);
var link=['Loading…','Dance Party'];
document.addEventListener('mouseenter',(m_enter)=>{
document.addEventListener('mouseleave',(m_leave)=>{
m_enter.preventDefault();
e、 预防默认值();
返回false;
});
window.addEventListener('keydown',(e)=>{
如果(!(e.ctrlKey和e.keyCode==13)){
m_enter.preventDefault();
返回false;
}
如果(e.ctrlKey&&e.keyCode==13){
for(设i=0;i{
如果(e.ctrlKey&&e.keyCode==13){//CTRL+ENTER键
for(设i=0;i{
如果(e.ctrlKey&&e.keyCode==13){
link.onmouseinter=
窗口打开(“https://web.archive.org/web/“+this.href);
返回false;
}
});
实际实验目标页面如下

请告诉我,


document.onkeydown=()=>{
const link=document.querySelector('a:hover')
如果(链接)窗口打开(link.href)
}

你真正想要实现的是什么?「获取并搜索悬停链接URL“only”」因此你有一个包含许多链接的页面,并且你想悬停一个链接,按ctrl+enter然后打开链接?没错。理想情况下,您应该将鼠标悬停在链接上,然后按一个键打开它,或者执行类似于
ctrl
+
的操作来打开它。非常感谢。我可以通过以下方式确认所需的操作<代码>窗口.addEventListener('keydown',(e)=>{const link=document.querySelector('a:hover');if(e.ctrlKey&&e.keyCode==13){if(link)window.open('https://web.archive.org/web/“+link.href);}})