我有這兩個簡單的頁面與jQuery功能不工作,雖然第一頁工作正常之前,我把另一個。 - WAMP Win7上HTML jQuery - 與JS不工作的簡單2頁?
的index.php
<!DOCTYPE html>
<html>
<head>
<title> Home</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
</head>
<body>
</body>
<script src="https://code.jquery.com/jquery-3.2.0.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="js/js.js"></script>
</html>
jQuery的js.js:
$(document).ready(function() {
alert('page1');
});
使page2.php
<!DOCTYPE html>
<html>
<head>
<title>eee</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
</head>
<body>
<script src="https://code.jquery.com/jquery-3.2.0.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="js/js_page2.js"></script>
</body>
</html>
個
js_page2.js
$(document).ready(function() {
alert('page2');
});
您是否在控制檯中發現任何錯誤? – Rayon
沒有先生只是空的頁面沒有任何警告或彈出窗口阻止通知 –
在瀏覽器中,有'開發人員工具(F12)'的選項,找到'控制檯'選項卡中。 – Rayon