【问题标题】:Javascript not working on GoDaddy hostingJavascript 在 GoDaddy 主机上不起作用
【发布时间】:2017-04-07 18:53:51
【问题描述】:

这是我的代码。

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。

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

有什么想法吗?谢谢。

【问题讨论】:

标签: javascript linux server


【解决方案1】:

我知道这不是答案,但在开发人员控制台中我没有看到任何下载的 JS 文件,并且我收到控制台错误,提示您的函数未定义。也许你忘了在&lt;head&gt; 标签中添加你的 JS 文件?

【讨论】:

  • 谢谢,仔细检查一下,它就在那里 跨度>
  • 不知道为什么找不到它。
  • 你是个天才!它在那里,但语言中的 L 大写,但它的引用不是。
  • 我觉得很尴尬,下次我会做更多的故障排除,但是谢谢大佬我开始慌了。
  • 没问题,发生在我们所有人身上,无论我们有多少经验
猜你喜欢
  • 1970-01-01
  • 2011-02-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-03-02
  • 1970-01-01
  • 2012-12-02
  • 2023-04-05
相关资源
最近更新 更多