2017-04-07 81 views
-1

這是我的代碼。Javascript無法在GoDaddy託管

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。

我不會說謊,我不太瞭解事物的服務器端。

任何想法?謝謝。

+2

您可以使用瀏覽器的開發人員控制檯來更好地瞭解錯誤。 (Chrome中的Ctrl + Shift + i,IE中的f12等)。 https://i.thomas.gg/qlP5yml.png – Chearful

+0

http://spacehelmetstudios.com/js/switchLanguage.js返回錯誤404 – Przemek

回答

0

我知道這不是答案,但在開發人員控制檯中,我沒有看到任何JS文件下載,並且出現控制檯錯誤,提示您的函數未定義。也許你忘了在你的<head>標籤中加入你的JS文件?

+0

謝謝,只是雙重檢查,它在那裏

+0

不知道爲什麼它找不到它。 –

+0

你是天才!它不是,但語言中的L是大寫,但它的參考不是。 –