|
#1
|
|||
|
|||
|
<% Date d=new Date(); out.println(d.getTime()); %> <html> <title>ajax programmming</title> <body> <h1> Welcome to Ajax programming </h1> <script type="text/javascript"> function ajaxFunction() { 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 doesn't support ajax"); return false; } } } xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4) { document.myform.time.value=xmlHttp.responseText; } } var rnd = Math.random(); var url="time.jsp?id="+Math.random(); xmlHttp.open("GET",url,true); xmlHttp.send(null); } </script> <form name="myform"> Name:<input type="text" Onkeyup="ajaxFunction();" name="username"> Time:<input type="text" name="time"> </form> </body> </html>
__________________
UK education consultant in coimbatore |
![]() |
|
|