Ajax page:
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "<a href =" http://www.w3.org/1999/xhtml "> http://www.w3.org/1999/xhtml">
<Head>
<Title> untitled page </title>
<****** Type = "text/JavaScript">
Function doing ()
{
VaR XMLHTTP;
Try
{
XMLHTTP = new XMLHttpRequest ();
}
Catch (E)
{
Try
{
XMLHTTP = new activexobject ("msxml2.xmlhttp ");
}
Catch (E)
{
Try
{
XMLHTTP = new activexobject ("Microsoft. XMLHTTP ");
}
Catch (E)
{
Alert ("your browser does not support Ajax! ");
Return false;
}
}
}
XMLHTTP. onreadystatechange = function ()
{
If (XMLHTTP. readystate = 4)
{
VaR strresult = XMLHTTP. responsetext;
Document. getelementbyid ("now"). value = strresult;
}
}
XMLHTTP. Open ("get", "Now. aspx", true );
XMLHTTP. Send (null );
}
Function gettingtime ()
{
Setinterval (doing, 1000 );
}
</SCRIPT>
</Head>
<Body onload = "gettingtime ();">
Current System Time:
<Input type = "text" id = "now">
</Body>
</Html>
Now. ASPX page:
<% @ Page Language = "C #" autoeventwireup = "true" codefile = "now. aspx. cs" inherits = "now" %>
Now. aspx. CS page:
Using system;
Using system. collections;
Using system. configuration;
Using system. Data;
Using system. LINQ;
Using system. Web;
Using system. Web. Security;
Using system. Web. UI;
Using system. Web. UI. htmlcontrols;
Using system. Web. UI. webcontrols;
Using system. Web. UI. webcontrols. webparts;
Using system. xml. LINQ;
Public partial class now: system. Web. UI. Page
{
Protected void page_load (Object sender, eventargs E)
{
Response. expires =-1;
Response. Write (datetime. Now. tostring ());
}
}