87,996
社区成员




<ul>
<li><span id='countdown_1'>00:00:58</span></li>
<li><span id='countdown_2'>00:00:16</span></li>
<li><span id='countdown_3'>00:00:58</span></li>
</ul>
<script type='text/javascript' src='/js/jquery/jquery-latest.js'></script>
<script type="text/javascript">
/*<![CDATA[*/
j_countdown_f( '#countdown_1');
j_countdown_f( '#countdown_2', {custom_time_s:'00:00:58'} );
j_countdown_f( '#countdown_3', {custom_time_s:'00:00:58'} );
/*
ext_o
{
custom_time_s: time format string('{0}:{1}:{2}')
done_callback_f: function
}
*/
function j_countdown_f( ele_j, ext_o )
{
ext_o = ext_o || {};
ele_j = $(ele_j);
var custom_time_s = $.trim(ext_o.custom_time_s);
if( custom_time_s=='' ){ custom_time_s = $.trim( ele_j.text() ); }
if(custom_time_s==''){ return; }
var countdown_d = new Date();
var date_a = custom_time_s.split(':');
for(var i=0, j=date_a.length; i<j; i++){ date_a[i] = parseInt( date_a[i], 10 )||0 };
if( date_a.length>0 ){ countdown_d.setSeconds( countdown_d.getSeconds() + date_a[date_a.length-1]); }
if( date_a.length>1 ){ countdown_d.setMinutes( countdown_d.getMinutes() + date_a[date_a.length-2]); }
if( date_a.length>2 ){ countdown_d.setHours( countdown_d.getHours() + date_a[date_a.length-3]); }
exec();
var x = setInterval( function(){ exec(); }, 1000 );
function exec()
{
var timestamp = Math.ceil( (countdown_d - new Date() )/1000 );
if(timestamp<=0)
{
ele_j.text( '00:00:00' ); return;
}
var h = '0' +Math.floor(timestamp/3600) % 60; h = h.slice( h.length-2 );
var m = '0'+ Math.floor(timestamp/60) % 60; m = m.slice( m.length-2 );
var s = '0'+timestamp % 60; s = s.slice( s.length-2 );
var result_ = h+':'+m+':'+s, h, m, s
ele_j.text( result_ );
}
}/* function j_countdown_f( ele_j, custom_time_s ) */
/*]]>*/
</script>