2016-08-18 59 views
0

我的網站有問題:jQuery無法正常工作。
我在我的腳本之前加載<head>標記中的jQuery。
你認爲它與Web服務器上的.htaccess和權限有關嗎?如果可能,我對index.php文件以下權限:jQuery未在我的網站上啓用

r-xrwxr-- 574 

這裏是一個鏈接到我的網站:http://hopdog.houa.org

這裏是有問題的代碼:

<!DOCTYPE html> 
<html> 
<head> 
<title>HopDog</title> 
<meta charset ="utf-8" /> 
<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.0.slim.min.js" > 

</script> 
<script> 
alert("$"); 
var menuState = "closed"; 
$("#ssl-seal-secure").click(function() { 
     alert("(это для украшения, ясно?)"); 
}); 
$("#shopB").attr("disabled", "true"); 
$("#shop").hide(); 
$("#login").hide(); 
$("#header1").hide(); 
$("#header2").hide(); 
$("#shopB").click(function() { 
     window.location.href("hopdog.houa.org/shop.php"); 
}); 
$("#header3").hide(); 
$("#header4").hide(); 
$("#mainB").hide(); 
       $("#shopB").hide(); 
       $("#myButton").hide(); 
$("#hm").click(function() { 
       if(menuState.indexOf("closed") == 0) { 
       $("#header1").show(); 
       $("#header").hide(); 
       $("#buyG").hide(); 
       $("#mainB").show(); 
       $("#shopB").show(); 
       $("#myButton").show(); 
       $("#mainB").click(function() { 
location.reload(true); 
}); 
       $("#myButton").click(function() { 
menuState="turtleLoginState"; 
$("#header3").show(); 
$("#header1").hide(); 
    $("#mainB").hide(); 
       $("#shopB").hide(); 
       $("#myButton").hide(); 
$("#login").show(); 
}); 
       menuState = "opened" 
       } else { 
        if(menuState.indexOf("turtleLoginState") == 0) { 
        $("#header1").show(); 
       $("#header3").hide(); 
       $("#login").hide(); 
       $("#buyG").hide(); 
       $("#mainB").show(); 
       $("#shopB").show(); 
       $("#myButton").show(); 
}else{ 
       menuState = "closed"; 
       $("#header").show(); 
       $("#buyG").show(); 
       $("#header1").hide(); 
       $("#mainB").hide(); 
       $("#shopB").hide(); 
       $("#myButton").hide(); 
} 
} 
}); 
</script> 
<body> 

    <button id="hm"> 
<img src="https://cdn0.iconfinder.com/data/icons/ui-icon-part-3/128/menu_hamburger-16.png" style="vertical-align:middle" /> 

</button> <p>HopDog оффициальный сайт</p> 
<div id="body"> 
<p id="header">Главная </p> 
<p id="header1">Меню сайта</p> 
<p id="header2">Магазин</p> 
<p id="header3">Вход</p> 
<p id="header4">Мой аккаунт</p> 
<hr size="2" /> 
<div id="body0"> 
<article> 
<div id="shop"> 
<p>under construction.. Sorry for that...</p> 
</div> 
<div id="login"> 
<input id="loginF" size="15" type="email" value="Имя пользователя" /> 
</br> 
<input id="password" type="password" /> 
<input id="submit" type="submit" /> <button id="reg" > <img src="https://cdn4.iconfinder.com/data/icons/business-and-office-2-6/65/55-16.png" />Зарегестрироваться</button> 
</div> 
<marquee id="buyG" behavior="alternete" direction="left" bgcolor="#ffffff">Сделайте предзаказ на Old House Story Сейчас!И получите бонусы на ваш счёт!! <span style="color:#006299;">[кликните чтоб попасть В магазин]</span></marquee> 
<input id="mainB" value="Главная" type="button" /> 
<input id="shopB" value="Магазин" type="button" /> 
<input id="myButton" value="Мой Аккаунт" type="button" /> 
</div> 
</article> 
</div> 
<img id="ssl-seal-secure" src="http://i80.fastpic.ru/thumb/2016/0815/fc/b4c2678de2ab9b4d1260420ddbc1e1fc.jpeg" alt="pseudo-secured by SSL.com (click for more info)" /> 
</body> 
</html> 

關於它的任何想法?
更新: 網站固定,所以更改了代碼。

+0

它對我沒有任何問題。我看到您正在嘗試使用code.jquery.com CDN,因此您的網絡瀏覽器或網絡可能會阻止它。嘗試將jQuery添加到您的Web服務器並從您自己的服務器獲取它。這個問題對我來說經常出現,所以我停止了對CDN的困擾。 – MonkeyZeus

回答

0

看看它是否會工作,如果你把它包含在body標籤的末尾。

像這樣:

<body> 
    <h1>Your elements</h1> 

    <!-- Scripts --> 
    <script src="https://code.jquery.com/jquery-3.1.0.slim.min.js"></script> 
    <script>Put your script here.</script> 
</body> 

如果仍然無法正常工作。也許嘗試不同的jQuery鏈接。 像這樣https://code.jquery.com/jquery-3.1.0.min.js

+0

謝謝!幫助。 –

+0

很高興幫助! – jamien