Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/434.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/5/url/2.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 如果提取的TXT不包含某个单词,我如何告诉imacros转到url?_Javascript_Url_Eval_Imacros_Goto - Fatal编程技术网

Javascript 如果提取的TXT不包含某个单词,我如何告诉imacros转到url?

Javascript 如果提取的TXT不包含某个单词,我如何告诉imacros转到url?,javascript,url,eval,imacros,goto,Javascript,Url,Eval,Imacros,Goto,我想问的是,如果找到了提取的单词,我如何告诉imacros转到某个页面。到目前为止,我想出了 TAG POS=1 TYPE=DIV ATTR=CLASS:"module-select" EXTRACT=TXT SET ref EVAL("var t = '{{!EXTRACT}}'.includes("and") window.location.href = ("https://www.google.com); return;") 但是我的JS脚本在EVAL中出现了一些错误,我无法理解。如果

我想问的是,如果找到了提取的单词,我如何告诉imacros转到某个页面。到目前为止,我想出了

TAG POS=1 TYPE=DIV ATTR=CLASS:"module-select" EXTRACT=TXT

SET ref EVAL("var t = '{{!EXTRACT}}'.includes("and") window.location.href = ("https://www.google.com); return;")

但是我的JS脚本在
EVAL
中出现了一些错误,我无法理解。如果有人能帮我解决这个问题,我将不胜感激。提前谢谢。我试图实现的是,当提取的文本包含单词“and”时,它将进入google.com(只是一个示例url),如果没有,它将什么也不做或跳到下一行。

您不能在
EVAL
命令中使用窗口对象和未替换的双引号。那么,试试这样的方法:

TAG POS=1 TYPE=DIV ATTR=CLASS:"module-select" EXTRACT=TXT
SET ref EVAL("('{{!EXTRACT}}'.includes('and')) ? 'https://www.google.com' : 'javascript: undefined;';")
URL GOTO={{ref}}

不能在
EVAL
命令中使用窗口对象和未缩放的双引号。那么,试试这样的方法:

TAG POS=1 TYPE=DIV ATTR=CLASS:"module-select" EXTRACT=TXT
SET ref EVAL("('{{!EXTRACT}}'.includes('and')) ? 'https://www.google.com' : 'javascript: undefined;';")
URL GOTO={{ref}}

再次感谢你shugar,你在修复imacros代码方面真的很有帮助。一旦我拿到笔记本电脑,我会尝试一下,并将结果更新给你。再次感谢你,shugar,你在修复imacros代码方面真的很有帮助。我会尝试一下,一旦我得到了我的笔记本电脑和更新你的结果。