我正在尝试使用下面的代码动态地在vb.net中追加时间,但我总是在参数列表"之后得到错误"请让我知道我错在哪里。
Dim st As String = "09:00 am"
Dim ed As String = "11:00 am"
Dim start As DateTime = DateTime.ParseExact(st, "hh:mm tt", Nothing)
Dim [end] As DateTime = DateTime.ParseExact(ed, "hh:mm tt", Nothing)
Dim interval As Integer = 30
Dim lstTimeIntervals As New List(Of String)
For i As Integer = 1 To 5
lstTimeIntervals.Add(start.ToString("hh:mm tt"))
start = start.AddMinutes(interval)
Response.Write(start + "<br/>")
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "time" + i.ToString, "alert('h');$('.cnt').append(" + start.TimeOfDay.ToString + ");", True)
Next
错误
$(&#39; .CNT&#39)附加(的 9时三十分00秒)。 //在参数列表之后,这里以粗体部分显示错误 $(&#39; .CNT&#39)。附加(的 10:00:00 )
答案 0 :(得分:0)
把时间用在引号中:
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "time" + i.ToString, "alert('h');$('.cnt').append('" + start.TimeOfDay.ToString + "');", True)