2010-10-10 20 views
0

我正在使用jQuery Countdown Plugin它可以工作,但如何嘗試使用「function showPauseTime()」函數的這段代碼我不斷收到錯誤showPauseTime undefined。如何使用jQuery Countdown Plugin功能

任何機構可以看看代碼,告訴我,我怎麼能解決這個感謝

$('#beginExercise').click(function() { 
    //check if terms checkbox is checked before stating timer        
    if($('#terms').is(':checked')){ 

      $("#pauseButton").show(); 

      //start time at zero 
      $("#elapsTimer").countdown({since: 0,onTick:showPauseTime}); 

      //Allow the Elaps Timer to be paused 
      $('#pauseButton').toggle(function() { 
        $(this).text('Resume Exercise'); 
        $('#elapsTimer').countdown('pause'); 
       }, 
       function() { 
        $(this).text('Pause Exercise'); 
        $('#elapsTimer').countdown('resume'); 
      }); 

      function showPauseTime(periods) { 
       $('#showPauseTime').text(periods[4] + ':' + twoDigits(periods[5]) + 
        ':' + twoDigits(periods[6])); 
      } 

    } //end if   
}); 

回答

0

你可以只保留功能:showPauseTime(週期){...}「點擊之外'事件,然後再試一次?

另外該函數需要一個參數:句點,這是沒有提供的函數調用,我猜。

+0

好,我試了一下,似乎是工作,但現在我得到一個其它的錯誤點擊功能外「twoDigits沒有定義」 也可以請你解釋一下不Ø熟悉它的參數時期 – Oudin 2010-10-10 19:48:47

+0

我想通出去工作的「twoDigits」正在使用,但沒有定義如何,如果你可以解釋的參數:期間將是有益的 – Oudin 2010-10-10 20:05:24

+0

我很抱歉,我的回覆延遲,Oudin。事實上,我只是通過檢查你的代碼來建議你。但是我很抱歉,我沒有插件。您可以查看插件代碼,瞭解它是如何在內部使用的。如果我得到時間,當然我會讓你知道參數:句號。 – 2010-10-13 06:08:55