让你开始的东西:
HTML
<span id="text">THIS</span>
JavaScript
function changeToTaht() {
// Change text, and call changeToThat, in 200ms
$('#text').text('TAHT');
setTimeout(changeToThat, 200);
}
function changeToThat() {
// Change text, and call changeToThis, in 3000ms
$('#text').text('THAT');
setTimeout(changeToThis, 3000);
}
function changeToThis() {
// Change text, and call changeToTaht, in 3000ms
// This will make the loop run again, and again, and again...
$('#text').text('THIS');
setTimeout(changeToTaht, 3000);
}
$(document).ready(function() {
// Start the loop by calling changeToTaht, in 1000ms
setTimeout(changeToTaht, 1000);
});
jsFiddle:http: //jsfiddle.net/Webye/