gpt4 book ai didi

JavaScript 不在 github.io 上执行,但在本地运行

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

我的 HTML 中有以下 JavaScript:

<script> 
// This is not needed when the the style is set in _layouts/base.html
// document.body.style.visibility = 'hidden';
function makeBodyVisible() { document.body.style.visibility = 'visible'; } if (window.addEventListener) window.addEventListener("load", makeBodyVisible, false);
else if (window.attachEvent) window.attachEvent("onload", makeBodyVisible);
else window.onload = makeBodyVisible;
</script>

但是,当页面加载时,它仍然隐藏。我还检查了是否创建了 window.onload 或任何其他事件监听器(使用 getEventListeners),但没有创建。这让我相信脚本没有运行。奇怪的是,这种情况只发生在我的 github.io 页面上,而在本地却发生了。有人可以告诉我发生了什么事吗?这是网站:https://botev.github.io/

最佳答案

我查看了您在答案中链接的网站 -看起来这个脚本被注释掉了!因此不会运行。附上截图。

Screenshot of production code for https://botev.github.io/, showing the script in question is commented out.

关于JavaScript 不在 github.io 上执行,但在本地运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49366300/

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