Pages

Friday, 31 May 2013

How To Make jQuery setTimeout() Function Example Using JavaScript in C# Asp.Net

 How To Make jQuery setTimeout() Function Example Using JavaScript in C# Asp.Net


Program:

.Aspx File:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JavaScript display current time on webpage</title>
<script type="text/javascript">
function ShowCurrentTime() {
var dt = new Date();
document.getElementById("lblTime").innerHTML = dt.toLocaleTimeString();
setTimeout("ShowCurrentTime()", 1000); // Here 1000(milliseconds) means one 1 Sec
}
</script>
</head>
<body onload="ShowCurrentTime()">
<div>
JavaScript Display current time second by second:
<label id="lblTime" style=" font-weight:bold"></label>
</div>
</body>
</html>

Live Demo:

JavaScript display current time on webpage
JavaScript Display current time second by second:

No comments:

Post a Comment