2013-04-14 148 views
0

我有不斷計算值的函數我嘗試按下按鈕時存儲這些函數的值,但是當我嘗試下面的代碼時無法正常工作。那麼如何在暫停按鈕時將其捕獲到變量中?從.text函數獲取值

songposition = $("#songCurrentpos").text(pad(Math.floor(current/60), 2) + ":" + pad(Math.floor(current % 60), 2));

songlength = $("#songDuration").text(pad(Math.floor(duration/60), 2) + ":" + pad(Math.floor(duration % 60), 2));

回答

0
// Set the values 
$("#songCurrentpos").text(pad(Math.floor(current/60), 2) + ":" + pad(Math.floor(current % 60), 2)); 
$("#songDuration").text(pad(Math.floor(duration/60), 2) + ":" + pad(Math.floor(duration % 60), 2)); 

// Get the values 
songposition = $("#songCurrentpos").text(); 
songlength = $("#songDuration").text();