-- timer 1 sec

This commit is contained in:
2024-02-18 16:33:49 -07:00
parent 991c4d0860
commit 575984ae3f
2 changed files with 11 additions and 9 deletions

View File

@@ -88,6 +88,7 @@
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpPanel">
<ContentTemplate>
<div class="row">
<%-- Boleto --%>
<div class="col-md-9">
<%-- Datos del Cliente --%>
@@ -105,9 +106,7 @@
<div class="col-md-4">
<asp:UpdatePanel runat="server" ID="UpTimer" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="lblTiempo" runat="server" Text="00:00:00"></asp:Label></p>
<asp:Timer ID="timerActualizar" runat="server" Interval="1000" OnTick="TimerActualizar_Tick" Enabled="False">
</asp:Timer>
<asp:Label ID="lblTiempo" runat="server" Text="00:00:00"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</div>
@@ -520,6 +519,7 @@
</table>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
@@ -527,16 +527,18 @@
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script type="text/javascript">
var tiempoTranscurrido = 0;
setInterval(actualizarTiempo, 1000);
function actualizarTiempo() {
tiempoTranscurrido++;
var horas = Math.floor(tiempoTranscurrido / 3600);
var minutos = Math.floor((tiempoTranscurrido % 3600) / 60);
var segundos = tiempoTranscurrido % 60;
var tiempoFormateado = (horas < 10 ? "0" : "") + horas + " : " + (minutos < 10 ? "0" : "") + minutos + " : " + (segundos < 10 ? "0" : "") + segundos + " s";
//(horas < 10 ? "0" : "") + horas + " : " +
var tiempoFormateado = (minutos < 10 ? "0" : "") + minutos + " : " + (segundos < 10 ? "0" : "") + segundos + " s";
document.getElementById('<%= lblTiempo.ClientID %>').innerText = tiempoFormateado;
}
</script>
</asp:Content>

View File

@@ -393,8 +393,8 @@ Partial Class Boletos
Return Retorno
End Function
Protected Sub TimerActualizar_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles timerActualizar.Tick
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "ActualizarTiempo", "actualizarTiempo();", True)
UpTimer.Update()
End Sub
'Protected Sub TimerActualizar_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles timerActualizar.Tick
' ScriptManager.RegisterStartupScript(Me, Me.GetType(), "ActualizarTiempo", "actualizarTiempo();", True)
' UpTimer.Update()
'End Sub
End Class