Javascript 无法在 GoDaddy 托管上运行

标签 javascript linux server

这是我的代码。

var cSharpButtons = document.getElementsByClassName("csharpbutton");
var jSButtons = document.getElementsByClassName("jsbutton");
var cSharp = document.getElementsByClassName("csharp");
var jS = document.getElementsByClassName("js");

function switchToCSharp() 
{
    for (i = 0; i < cSharpButtons.length; i++) //change button colors
    { 
        cSharpButtons[i].style.backgroundColor = "#00AEEF";
    }
    for (i = 0; i < jSButtons.length; i++) 
    { 
        jSButtons[i].style.backgroundColor = "lightgrey";
    }

    for (i = 0; i < cSharp.length; i++) //change code
    { 
        cSharp[i].style.display = "inline";
    }
    for (i = 0; i < jS.length; i++) 
    { 
        jS[i].style.display = "none";
    }

}

function switchToJS() 
{
    for (i = 0; i < jSButtons.length; i++) //change button colors
    { 
        jSButtons[i].style.backgroundColor = "#00AEEF";
    }
    for (i = 0; i < cSharpButtons.length; i++) 
    { 
        cSharpButtons[i].style.backgroundColor = "lightgrey";
    }

    for (i = 0; i < cSharp.length; i++) //change code
    { 
        cSharp[i].style.display = "none";
    }
    for (i = 0; i < jS.length; i++) 
    { 
        jS[i].style.display = "inline";
    }
}   

GoDaddy 表示许可没问题。在我的桌面上就像一个魅力,他们说我的代码一定有问题。他们说这可能是一种过时的编码方式。

当您按下按钮时没有任何反应,要亲自尝试一下,请访问 http://spacehelmetstudios.com/tutorials/unity2d/directionalgravity2d/directionalgravity2d.html并尝试将其从 C# 更改为 JS。

我不会撒谎,我对服务器端的事情不太了解。

有什么想法吗?谢谢。

最佳答案

我知道这不是答案,但在开发人员控制台中我没有看到任何下载的 JS 文件,并且收到控制台错误,指出您的函数未定义。也许您忘记将 JS 文件添加到 <head> 中标签?

关于Javascript 无法在 GoDaddy 托管上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43285256/

相关文章:

python - 如何在 python 中处理 UDP 套接字客户端

javascript - 在 Javascript 数字猜谜游戏中插入循环

javascript - 联系表上的帮助不大?

javascript - 切换路线时停止 Controller 的事件

node.js - 当进程被阻塞时,nodejs服务器请求会发生什么

node.js - 如何使用 node.js 从服务器端刷新浏览器?

javascript - 菜单应该隐藏 onmouseout 但它隐藏 onmouseover

linux - 在 Ubuntu 上检索可用的 Wifi 网络

php - 如何从 php 运行 linux 命令

java - 是否可以限制 GlassFish(或底层 jvm 机器)中的端口号保留范围?