Introduction
In this
article we are going to discuss about how to set the time interval for the
method using the jquery for continues calling with the time interval
For down
load the jquery file from this location
https://simplemodal.googlecode.com/files/jquery.simplemodal-1.4.1.js
<%@ Page
Language="C#"
AutoEventWireup="true"
CodeBehind="TimeIntervelJavasctipt.aspx.cs"
Inherits="SampleTestingCodes.TimeIntervelJavasctipt"
ClientIDMode="Static"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Jquery Set Time Intervel</title>
<script src="js/jquery-1.4.1.js"
type="text/javascript"></script>
<script type="text/javascript">
var myVar = null;
function DataCalling() {
var date = new
Date();
$("#txtDateTime").val(date);
}
function StartTimer() {
myVar = setInterval(function () {
DataCalling(); }, 1000);
}
function StopTimer() {
clearInterval(myVar)
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtDateTime"
runat="server"
Height="21px"
Width="270px"></asp:TextBox>
<asp:Button ID="btnStart"
runat="server"
Text="Start"
OnClientClick="StartTimer();
return false;" />
<asp:Button ID="btnStop"
runat="server"
Text="Stop"
OnClientClick="StopTimer();
return false;" />
</div>
</form>
</body>
</html>
No comments:
Post a Comment