SoFunction
Updated on 2025-04-03

Example of how many seconds has passed since the last refresh of JS implementation


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:///TR/xhtml1/DTD/">
<html xmlns="http:///1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Unt titled document</title>
<script src="/ajax/jquery/jquery-1.9."></script>
<script type="text/javascript">
$(function() {
// JQuery code

var oldhh;
var oldmin;
var oldss;

$(document).ready(function() {
fillDate();
});
function fillDate(){
var date = new Date();
var yy = ();
var mm = ()+1; //Intercept the month,
var dd = (); //intercept the date,
var cal = yy+"."+ mm +"."+dd;
var hh = (); //Intercept the hours,
var min = (); //Seave minutes,

var ss = () % 60000;
ss = (ss - (ss % 1000)) / 1000; //Then, process the obtained milliseconds into seconds
//(hh+":"+min+":"+ss);
oldhh = hh;
oldmin = min;
oldss = ss;
//alert(oldmin+":"+oldss);
}
(test,1000);
function test(){
var date = new Date();
var hh = (); //Intercept the hour, that is, 8
var min = (); //Intercept minute, that is, 34
var ss = () % 60000;
ss = (ss - (ss % 1000)) / 1000; //Then, process the obtained milliseconds into seconds
var betweenhh;
var betweenmin;
var betweenss;

if(ss<oldss){
betweenss = ss+60-oldss;
betweenhh = hh-oldhh;
betweenmin = (min+betweenhh*60)-1 - oldmin;


//alert("From the last refresh"+betweenmin+"minutes"+betweenss+"seconds");
}else{
betweenss = ss-oldss;
betweenhh = hh-oldhh;
betweenmin = (min + betweenhh*60) - oldmin;
//$("#message").html("From the last refresh"+betweenmin+"minutes"+betweenss+"seconds");
//alert("From the last refresh"+betweenmin+"minutes"+betweenss+"seconds");
}
if(betweenmin<10){
if(betweenss<10){
$("#message").html("Distance from last refresh 0"+betweenmin+"minute 0"+betweenss+"second");
}else{
$("#message").html("0 from last refresh" + betweenmin+"minute" + betweenss+"second");
}

}else{
if(betweenss<10){
$("#message").html("Distance from last refresh"+betweenmin+"minute 0"+betweenss+"second");
}else{
$("#message").html("Distance from last refresh"+betweenmin+"minutes"+betweenss+"seconds");
}
}
}
});
function ByStateflag()
{
alert("hah");
var value = ("stateflag").value;
alert(value);
}
</script>
</head>
<body>
<div >

</div>
<select name="stateflag" onchange="ByStateflag()">
<option selected value="">Trading status</option>
<option value="0">In progress</option>
<option value="1">Terminate transaction</option>
<option value="3">Buyer has locked the goods</option>
<option value="4">Buyer payment</option>
<option value="5">Transaction completion</option>
</select>

</body>
</html>