增加作业倒计时显示
This commit is contained in:
parent
2de2355e5c
commit
d0e549fc85
|
@ -1,4 +1,23 @@
|
|||
<!--modified by huang-->
|
||||
<script type="text/javascript">
|
||||
function ShowCountDown(year,month,day,divname)
|
||||
{
|
||||
var now = new Date();
|
||||
var endDate = new Date(year, month-1, day);
|
||||
var leftTime=endDate.getTime()-now.getTime();
|
||||
var leftsecond = parseInt(leftTime/1000);
|
||||
var day1=Math.floor(leftsecond/(60*60*24));
|
||||
var hour=Math.floor((leftsecond-day1*24*60*60)/3600);
|
||||
var minute=Math.floor((leftsecond-day1*24*60*60-hour*3600)/60);
|
||||
var second=Math.floor(leftsecond-day1*24*60*60-hour*3600-minute*60);
|
||||
$("#"+divname).html("<span style='color: #acaeb1;'>作业提交还剩 :</span> <span style='color: red;'>"
|
||||
+day1+" </span><span style='color: #acaeb1;'>天</span><span style='color: red;'> "
|
||||
+hour+" </span><span style='color: #acaeb1;'>时</span><span style='color: red;'> "
|
||||
+minute+" </span><span style='color: #acaeb1;'>分</span><span style='color: red;'> "
|
||||
+second+" </span><span style='color: #acaeb1;'>秒</span>");
|
||||
}
|
||||
</script>
|
||||
|
||||
<% if bids.blank? %>
|
||||
<%#= l(:label_uncommit_homework) %>
|
||||
暂无作业!
|
||||
|
@ -100,11 +119,11 @@
|
|||
<%= l(:label_commit_limit)%>
|
||||
</span>
|
||||
<% else %>
|
||||
<% if betweentime(bid.deadline) < 3 %>
|
||||
<span style="color: red">
|
||||
<%= l(:label_commit_ar) %>
|
||||
</span>
|
||||
<% end %>
|
||||
<script type="text/javascript">
|
||||
window.setInterval(function(){ShowCountDown(<%= bid.deadline.year%>,<%= bid.deadline.month%>,<%= bid.deadline.day + 1%>,"show_deadtime_span_<%= bid.id%>");},1000)
|
||||
</script>
|
||||
<span id="show_deadtime_span_<%= bid.id%>" style="float: right">
|
||||
</span>
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
|
|
Loading…
Reference in New Issue