running time watch

running time watch

how to set running watch in applycation with ajax ?

View Answers

January 22, 2011 at 4:47 PM

Hi Friend,

Try the following code:

displaytime.jsp:

<html>
<head>
<script type="text/javascript">
function showData(){ 

xmlHttp=GetXmlHttpObject()
var url="displaytime.jsp";
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged() { 
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
    var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
m=checkTime(m);
s=checkTime(s);
document.getElementById('time').innerHTML=h+":"+m+":"+s;
t=setTimeout('showData()',500);
}

function checkTime(i)
{
if (i<10)
  {
  i="0" + i;
  }
return i;
}
}


function GetXmlHttpObject(){
var xmlHttp=null;
try {
  xmlHttp=new XMLHttpRequest();
 }
catch (e) {
 try  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
</script>
</head>
<body onload="showData();">
<div id="time" ></div>
</body>
</html>

Thanks

Ads









Related Tutorials/Questions & Answers:
running time watch
running time watch   how to set running watch in applycation with ajax
how to set running watch with descending order in applycation with ajax
how to set running watch with descending order in applycation with ajax   like hh : mm : ss 23 : 59 : 59 23 : 58 : 10 22 : 20 : 01 21 : 45 : 59 . . . . . . 02 : 23 : 03 01 : 10 : 23 00 : 00 : 00
Advertisements
how to set running watch with descending order in applycation with ajax
how to set running watch with descending order in applycation with ajax   like hh : mm : ss 23 : 59 : 59 23 : 58 : 10 22 : 20 : 01 21 : 45 : 59 . . . . . . 02 : 23 : 03 01 : 10 : 23 00 : 00 : 00
identify the order of the average running time of the method
identify the order of the average running time of the method  public static double getMedian (double[] A) { // given an ordered array of length n, return the median int n = A.length; if ((n % 2) == 1) return A[n/2]; else
identify the order of growth of the average running time of the method.
identify the order of growth of the average running time of the method.   public static void manypeak (int n, double size) { if (n > 0) manypeak... drawpeak() takes constant time } if (n>0) manypeak(n/2, size/2
identify the order of growth of the average running time of the method.
identify the order of growth of the average running time of the method.   public static void manypeak (int n, double size) { if (n > 0) manypeak... drawpeak() takes constant time } if (n>0) manypeak(n/2, size/2
ModuleNotFoundError: No module named 'watch'
ModuleNotFoundError: No module named 'watch'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'watch' How to remove the ModuleNotFoundError: No module named 'watch'
Version of com.opentangerine>ot-watch dependency
List of Version of com.opentangerine>ot-watch dependency
time
time  how to find the current system time between the user login and logout using java
ModuleNotFoundError: No module named 'awslogs-watch'
ModuleNotFoundError: No module named 'awslogs-watch'  Hi, My... 'awslogs-watch' How to remove the ModuleNotFoundError: No module named 'awslogs-watch' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'django-watch'
ModuleNotFoundError: No module named 'django-watch'  Hi, My Python... 'django-watch' How to remove the ModuleNotFoundError: No module named 'django-watch' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'import-watch'
ModuleNotFoundError: No module named 'import-watch'  Hi, My Python... 'import-watch' How to remove the ModuleNotFoundError: No module named 'import-watch' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'just-watch'
ModuleNotFoundError: No module named 'just-watch'  Hi, My Python... 'just-watch' How to remove the ModuleNotFoundError: No module named 'just-watch' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'mongo-watch'
ModuleNotFoundError: No module named 'mongo-watch'  Hi, My Python... 'mongo-watch' How to remove the ModuleNotFoundError: No module named 'mongo-watch' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'motor-watch'
ModuleNotFoundError: No module named 'motor-watch'  Hi, My Python... 'motor-watch' How to remove the ModuleNotFoundError: No module named 'motor-watch' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'motor-watch'
ModuleNotFoundError: No module named 'motor-watch'  Hi, My Python... 'motor-watch' How to remove the ModuleNotFoundError: No module named 'motor-watch' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'nbconvert_watch'
ModuleNotFoundError: No module named 'nbconvert_watch'  Hi, My... named 'nbconvert_watch' How to remove the ModuleNotFoundError: No module named 'nbconvert_watch' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'nbconvert_watch'
ModuleNotFoundError: No module named 'nbconvert_watch'  Hi, My... named 'nbconvert_watch' How to remove the ModuleNotFoundError: No module named 'nbconvert_watch' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'nights-watch'
ModuleNotFoundError: No module named 'nights-watch'  Hi, My Python... 'nights-watch' How to remove the ModuleNotFoundError: No module named 'nights-watch' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'nose-watch'
ModuleNotFoundError: No module named 'nose-watch'  Hi, My Python... 'nose-watch' How to remove the ModuleNotFoundError: No module named 'nose-watch' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'pytest-watch'
ModuleNotFoundError: No module named 'pytest-watch'  Hi, My Python... 'pytest-watch' How to remove the ModuleNotFoundError: No module named 'pytest-watch' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'python-watch'
ModuleNotFoundError: No module named 'python-watch'  Hi, My Python... 'python-watch' How to remove the ModuleNotFoundError: No module named 'python-watch' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'rsync-watch'
ModuleNotFoundError: No module named 'rsync-watch'  Hi, My Python... 'rsync-watch' How to remove the ModuleNotFoundError: No module named 'rsync-watch' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'trustlines-watch'
ModuleNotFoundError: No module named 'trustlines-watch'  Hi, My... named 'trustlines-watch' How to remove the ModuleNotFoundError: No module named 'trustlines-watch' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'watch-diff'
ModuleNotFoundError: No module named 'watch-diff'  Hi, My Python... 'watch-diff' How to remove the ModuleNotFoundError: No module named 'watch-diff' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'watch-dog'
ModuleNotFoundError: No module named 'watch-dog'  Hi, My Python... 'watch-dog' How to remove the ModuleNotFoundError: No module named 'watch... have to install padas library. You can install watch-dog python with following
ModuleNotFoundError: No module named 'watch-fs'
ModuleNotFoundError: No module named 'watch-fs'  Hi, My Python... 'watch-fs' How to remove the ModuleNotFoundError: No module named 'watch-fs... to install padas library. You can install watch-fs python with following
ModuleNotFoundError: No module named 'watch-rsync'
ModuleNotFoundError: No module named 'watch-rsync'  Hi, My Python... 'watch-rsync' How to remove the ModuleNotFoundError: No module named 'watch-rsync' error? Thanks   Hi, In your python environment
time
time  Hi. I have retrieved time from mysql database. its in th format hh:mm:ss. but i want to display only as hh:mm. wat to do? For this i already received the answer. But its converting the time in 24hr format to 12hr format
time
time  Hi. I have retrieved time from mysql database. its in th format hh:mm:ss. but i want to display only as hh:mm. wat to do? For this i already received the answer. But its converting the time in 24hr format to 12hr format
time
time  Hi. I have retrieved time from mysql database. its in th format hh:mm:ss. but i want to display only as hh:mm. wat to do? For this i already received the answer. But its converting the time in 24hr format to 12hr format

Ads