2012-08-17 57 views

回答

2

可以使用的setInterval https://developer.mozilla.org/en-US/docs/DOM/window.setInterval

setInterval(function() { 
    $('p').fadeOut(500, function() { 
     var $this = $(this); 
     $this.text($this.text() == 'Connected' ? '2457' : 'Connected');   
     $this.toggleClass('first second');   
     $this.fadeIn(500); 
    }); 
}, 3000);​ 

http://jsfiddle.net/wirey00/E4xqg/

+0

尼斯。我可以看到有人可能使用:$(this).text($(this).text()=='需要幫助嗎?''請點擊這裏!':'需要幫助嗎?');在一個錨而不是一個P只是爲了引起人們對鏈接的關注。 – mikeY 2012-08-17 17:36:30