다음은 내 코드입니다.GoDaddy 호스팅에서 Javascript가 작동하지 않습니다.
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로 변경하십시오.
나는 거짓말을하지 않을 것이고, 나는 서버 측에 대해서 많이 모른다.
아이디어가 있으십니까? 감사.
브라우저의 개발자 콘솔을 사용하여 오류를 더 잘 이해할 수 있습니다. (Chrome에서는 Ctrl + Shift + i, IE에서는 f12 등). https://i.thomas.gg/qlP5yml.png – Chearful
http://spacehelmetstudios.com/js/switchLanguage.js가 오류 404를 반환합니다. – Przemek