【发布时间】:2014-06-29 02:29:27
【问题描述】:
游戏非常简单,您单击开始按钮开始,然后沿着轨道移动鼠标直到到达终点,然后计时器停止并显示分数。如果你跑出赛道,你会得到零分。
为什么我的 mouseOver 功能不起作用? 链接到我的完整代码:http://www.codecademy.com/TictacTactic/codebits/AQBK4L/edit
提前谢谢你!
var score = 1000;
var timer = setInterval(countDown(), 1000);
$(document).ready(function() {
$('#start').click(function() {
$('#game').mouseover(function() {
stopTimer();
score = 0
$('#points').html(score)
});
$('#end').mouseover(function() {
stopTimer()
$('#points').html(score)
});
});
});
function countDown() {
score = score - 1;
}
function stopTimer() {
clearInterval(timer);
}
【问题讨论】:
-
mouseOver != mouseover,问题出在这里。 -
为什么不贴相关代码?
-
感谢您的帮助。我是新来的。
标签: javascript jquery html function mouseover