diff BoosterPack/perltest/.svn/text-base/index.html.svn-base @ 0:0d795f02a8bb tip

initial committ. what was I thinking?
author Robert McIntyre <rlm@mit.edu>
date Mon, 27 Sep 2010 16:57:26 -0400
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/BoosterPack/perltest/.svn/text-base/index.html.svn-base	Mon Sep 27 16:57:26 2010 -0400
     1.3 @@ -0,0 +1,45 @@
     1.4 +<html>
     1.5 +<head>
     1.6 +<title>Simple Ajax Example</title>
     1.7 +<script language="Javascript">
     1.8 +function xmlhttpPost(strURL) {
     1.9 +    var xmlHttpReq = false;
    1.10 +    var self = this;
    1.11 +    // Mozilla/Safari
    1.12 +    if (window.XMLHttpRequest) {
    1.13 +        self.xmlHttpReq = new XMLHttpRequest();
    1.14 +    }
    1.15 +    // IE
    1.16 +    else if (window.ActiveXObject) {
    1.17 +        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    1.18 +    }
    1.19 +    self.xmlHttpReq.open('POST', strURL, true);
    1.20 +    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    1.21 +    self.xmlHttpReq.onreadystatechange = function() {
    1.22 +        if (self.xmlHttpReq.readyState == 4) {
    1.23 +            updatepage(self.xmlHttpReq.responseText);
    1.24 +        }
    1.25 +    }
    1.26 +    self.xmlHttpReq.send(getquerystring());
    1.27 +}
    1.28 +
    1.29 +function getquerystring() {
    1.30 +    var form     = document.forms['f1'];
    1.31 +    var word = form.word.value;
    1.32 +    qstr = 'w=' + escape(word);  // NOTE: no '?' before querystring
    1.33 +    return qstr;
    1.34 +}
    1.35 +
    1.36 +function updatepage(str){
    1.37 +    document.getElementById("result").innerHTML = str;
    1.38 +}
    1.39 +</script>
    1.40 +</head>
    1.41 +<body>
    1.42 +<form name="f1">
    1.43 +  <p>word: <input name="word" type="text">  
    1.44 +  <input value="Go" type="button" onclick='JavaScript:xmlhttpPost("./simple-ajax-example.cgi")'></p>
    1.45 +  <div id="result"></div>
    1.46 +</form>
    1.47 +</body>
    1.48 +</html>