selectname.htm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>Customer Account Information</title>
    <script type="text/javascript">
        var urlGet = "getdata.php?id=1"; // The server-side script
    var urlPost = "putdata.php"; // The server-side script

    varExpiries = 1

       function handleGetHttpResponse() {   
        if (httpGet.readyState == 4) {
              if(httpGet.status==200) {
                  var results="The current suggestion is "+ httpGet.responseText + " (" + varExpiries + ")";

            document.getElementById('divCustomerInfo').innerHTML = results;
            document.getElementById('buttonAgree').style.visibility = "visible"

            varExpiries++;

            setTimeout("TimerExpire()",3000);
        
                  
              }

            
              }

        }

    function handleSuggestHttpResponse() 
    {   
            if (httpSuggest.readyState == 4) 
        {
            if(httpGet.status==200) 
            {
                //No action yet
                      }
        }
        }
       
        function getSuggestions() {    
        var urlGetWithHash = urlGet + "&hash=" + Math.random();

            httpGet.open("GET", urlGetWithHash, true);
            httpGet.onreadystatechange = handleGetHttpResponse;
        httpGet.send(null);
        }

       
        function suggest() 
    {    
        var sSuggestion = document.getElementById("txtSuggestion").value;
        var urlPostWithParameters = urlPost + "?Suggestion=" + sSuggestion; 

        httpSuggest.open("POST", urlPostWithParameters, true);
        httpSuggest.onreadystatechange = handleSuggestHttpResponse;
        httpSuggest.send(null);  
        }

        function agree() {   
        top.location="next.htm"
        }


function getHTTPObject() {
  var xmlhttp;

  if(window.XMLHttpRequest){
    xmlhttp = new XMLHttpRequest();
  }
  else if (window.ActiveXObject){
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    if (!xmlhttp){
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
   
}
  return xmlhttp;

 
}

var httpGet = getHTTPObject();
var httpSuggest = getHTTPObject();

//Timer test

function TimerExpire(){
     //document.getElementById('divCustomerInfo').innerHTML = "Timer has expired " + varExpiries + " times";
    getSuggestions()

}


setTimeout("TimerExpire()",3000);

</script>
</head>
<body>
    <p>Make a suggestion: <input type="text" id="txtSuggestion" value="" /></p>
    <p><input type="button" value="Suggest" onclick="suggest()" /></p>
    <p><i><span id="divCustomerInfo">Waiting for a suggestion...</span></i></p>
    <p><INPUT ID="buttonAgree" TYPE="button" VALUE="Agree" onclick="agree()" style="position: absolute; visibility: hidden;" /></p>
</body>
</html>