aboutsummaryrefslogtreecommitdiff
path: root/ajax/simple_form/index.htm
diff options
context:
space:
mode:
Diffstat (limited to 'ajax/simple_form/index.htm')
-rw-r--r--ajax/simple_form/index.htm36
1 files changed, 36 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