chronometer in col

Questionschronometer in col
C3media asked 4 years ago

Hello i have this code to start chronometer and works fine:

<script type="text/javascript">
//setInterval
var cronometro;
function detenerse()
{
clearInterval(cronometro);
}
function carga()
{
contador_s =0;
contador_m =0;
s = document.getElementById("segundos");
m = document.getElementById("minutos");
cronometro = setInterval(
function(){
if(contador_s==60)
{
contador_s=0;
contador_m++;
m.innerHTML = contador_m;
if(contador_m==60)
{
contador_m=0;
}
}
s.innerHTML = contador_s;
contador_s++;
}
,1000);
}
</script>

<body onload="carga()">
<p>
<span id="minutos">0</span>:<span id="segundos">0</span>
</p>
<input type="button" onclick="detenerse()" value="Stop"/>
</body>

There is possible to call this function using method On_after_insert and on_after_update?

Thank you by your help!

1 Answers
Abu Ghufran answered 4 years ago

Hi,

Your ticket somehow got delayed, apologies for that.
You cannot have JS code inside php callback functions.

You can have it using loadComplete event and it will run everytime grid reloads.
For usage ref: you can review demos/editing/custom-events.php

For element selection like:
s = document.getElementById("segundos");
m = document.getElementById("minutos");
You can inspect using firebug (f12) and replace element id.

Your Answer

10 + 7 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?