Introduction:
Description:
In previous articles I explained Get Current Datetime, Auto refresh page , Expand textbox on focus ,Disable right click on image and many articles relating to JQuery. Now I will explain how to show or display current time on webpage using jQuery.
In previous articles I explained Get Current Datetime, Auto refresh page , Expand textbox on focus ,Disable right click on image and many articles relating to JQuery. Now I will explain how to show or display current time on webpage using jQuery.
To display current time on website or webpage using jQuery
we need to write the following code
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>jQuery display current time on webpage</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function()
{
ShowTime();
});
function ShowTime() {
var dt = new Date();
document.getElementById("lblTime").innerHTML =
dt.toLocaleTimeString();
window.setTimeout("ShowTime()", 1000);
}
</script>
</head>
<body >
<form id="form1"
runat="server">
<div>
jQuery Display time second by second.
<label id="lblTime"
style=" font-weight:bold"></label>
</div>
</form>
</body>
</html>
|
Live Demo
jQuery Display time second by second.
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
7 comments :
how to lazy load use to Datalist for Image
asp.net C#..
please ans....
how to show it in a masterpage
nyc.....
how to show it in a masterpage ?
good
Good Article ,
But how can I show a clock(i.e watch) on the page
Thank you.It's working fine.
Note: Only a member of this blog may post a comment.