我刚刚开始使用 HTML/CSS/jQuery,我尝试开始基本。目前我有一个 .html、.css 和 .js。我的 index.html 将加载 .css 但不会加载 .js。我的代码有问题吗?
HTML
<!DOCTYPE html>
<html>
<head>
<title>Super Mario!</title>
<link rel='stylesheet' type='text/css' href='stylesheet.css'/>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<img src="http://i1061.photobucket.com/albums/t480/ericqweinstein/mario.jpg"/>
</body>
</html>
CSS
img {
position: relative;
left: 100px;
top: 100px;
}
jQuery
$(document).ready(function() {
$(document).keydown(function(key) {
switch(parseInt(key.which,10)) {
case 65:
$('img').animate({left: "-=10px"}, 'fast');
break;
case 83:
$('img').animate({top: "+=10px"}, 'fast');
break;
case 87:
$('img').animate({top: "-=10px"}, 'fast');
break;
case 68:
$('img').animate({left: "+=10px"}, 'fast');
break;
default:
break;
}
});
});
请帮我弄清楚为什么这不起作用。一些附加信息,它们都位于我桌面上的同一个文件夹中。没有子文件夹。