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

View File

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