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;
}
});
});
これが機能しない理由を理解するのを手伝ってください。いくつかの追加情報、それらはすべてデスクトップの同じフォルダーにあります。サブフォルダーはありません。