diff options
Diffstat (limited to 'ajax/simple_form')
-rw-r--r-- | ajax/simple_form/index.htm | 36 | ||||
-rw-r--r-- | ajax/simple_form/time.php | 6 |
2 files changed, 42 insertions, 0 deletions
diff --git a/ajax/simple_form/index.htm b/ajax/simple_form/index.htm new file mode 100644 index 0000000..2c01922 --- /dev/null +++ b/ajax/simple_form/index.htm @@ -0,0 +1,36 @@ +<html> +<body> + +<script type="text/javascript"> +function ajaxFunction() +{ +var xmlhttp; +if (window.XMLHttpRequest) + { + // code for IE7+, Firefox, Chrome, Opera, Safari + xmlhttp=new XMLHttpRequest(); + } +else + { + // code for IE6, IE5 + xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); + } +xmlhttp.onreadystatechange=function() +{ +if(xmlhttp.readyState==4) + { + document.myForm.time.value=xmlhttp.responseText; + } +} +xmlhttp.open("GET","time.php",true); +xmlhttp.send(null); +} +</script> + +<form name="myForm"> +Name: <input type="text" name="username" onkeyup="ajaxFunction();" /> +Time: <input type="text" name="time" /> +</form> + +</body> +</html>
\ No newline at end of file diff --git a/ajax/simple_form/time.php b/ajax/simple_form/time.php new file mode 100644 index 0000000..3d938ae --- /dev/null +++ b/ajax/simple_form/time.php @@ -0,0 +1,6 @@ +<?php +// Date in the past +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Cache-Control: no-cache"); +echo(date("G:i:s",time())); +?>
\ No newline at end of file |