是什麼導致setInterval
不會在fadeOut
中被調用?setInterval不會在fadeOut中被調用
<!doctype html>
<html>
<head>
<title>Exercise</title>
<style>
#box {
}
</style>
</head>
<body>
<div id="box"></div>
<script src="jquery.js"></script>
<script>
$(function() {
$("#box").fadeOut(3000, function() {
setInterval("UpdateTime()", 100);
});
});
function GetTime() {
var now = new Date();
var obj = {
Hour: now.getHours(),
Minute: now.getMinutes(),
Second: now.getSeconds()
};
return obj;
}
function UpdateTime() {
var box = $("#box");
var obj = GetTime();
if (obj.Hour < 10)
obj.Hour = "0" + obj.Hour;
if (obj.Minute < 10)
obj.Minute = "0" + obj.Minute;
if (obj.Second < 10)
obj.Second = "0" + obj.Second;
box.text(obj.Hour + ":" + obj.Minute + ":" + obj.Second);
}
</script>
</body>
</html>
'的setInterval(錄入,100);' – melancia 2014-09-05 22:02:32
你是隱藏用盒子'淡出()'那麼誰是顯示回來? – 2014-09-06 01:11:09
請參閱http://jsfiddle.net/arunpjohny/hee5um81/1/或http://jsfiddle.net/arunpjohny/hee5um81/2/ – 2014-09-06 01:11:41