Below example helps you to display current time on the web page. Textbox value will be updated with the current time every second.
Add following code to the page,
<script type="text/javascript">
function DisplayTime()
{
var currentDate = new Date();
document.getElementById("<%= TextTime.ClientID %>").value = currentDate.toLocaleTimeString();
window.setTimeout("DisplayTime()", 1000);
}
</script>
<script type="text/javascript">
window.setTimeout("DisplayTime()", 1000);
</script>
<asp:TextBox ID="TextTime" runat="server"></asp:TextBox>
The .NET Framework allows developers to use the same set of skills to rapidly buid great applications for the web, windows, services and more.
Display Current Time on the web page
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment