我有一些带有data-date的HTML,但我必须检查当前日期并添加到该元素选择的类,如果日期已经过去,那么我已经添加到最新传递的活动类,但是如果将来只有日期必须添加到第一个即将到来。
以下是我的HTML,我不知道如何启动JS
<!-- BEGIN EVENT. DATE FORMAT - MM/DD/YYYY -->
<div class = "event" data-date = "03/9/2013">
<div class = "layout1"> <!-- BEGIN 'LAYOUT1' -->
<div class = "left">
<img src = "images/1.jpg" alt = "image alt"/>
</div>
<div class = "right">
<h3>This is Layout 1</h3>
<p>Some text goes here...</p>
</div>
</div>
<span class = "date"><i class = "icon-calendar"></i>09.03.2013</span>
</div><!-- END EVENT -->
<!-- BEGIN EVENT. DATE FORMAT - MM/DD/YYYY -->
<div class = "event" data-date = "03/8/2016">
<div class = "layout1"> <!-- BEGIN 'LAYOUT1' -->
<div class = "left">
<img src = "images/1.jpg" alt = "image alt"/>
</div>
<div class = "right">
<h3>This is Layout 12</h3>
<p>Some text goes here...</p>
</div>
</div>
<span class = "date"><i class = "icon-calendar"></i>09.03.2013</span>
</div><!-- END EVENT -->
我需要的是附加选定的
类事件答案 0 :(得分:1)
您可以执行类似
的操作Dim rst As Recordset
Set rst = DBEngine(0)(0).OpenRecordset("select * from TimeTable where UserID = " & UserId & " and WorkDate= #" & Format(Date, "mm\/dd\/yyyy") & "#")
With rst
If .RecordCount > 0 Then
.Edit
!Time_Out = Now()
Else
.AddNew
!UserId = UserId
!WorkDate = Date
!Time_In = Now
End If
.Update
End With
rst.Close
Set rst = Nothing
您可以在此处阅读有关JavaScript日期的更多信息 http://www.w3schools.com/js/js_dates.asp