OSDN Git Service

replaced all files
[vem/WITs.git] / JS / EucentricHeight.js
1 function EucentricHeight(command,max,speed,place){
2
3                 var ajax=getAjax();
4
5  if(command == "EucentricHeight"){
6         var nmax = document.getElementById("max");
7                                 var nspeed=document.getElementById("speed");
8                                 var nplace=document.getElementById("place");
9         }else {
10                 var result = document.getElementById("max");
11         }
12
13         if (ajax) {
14                  try{
15                          ajax.onreadystatechange = getData;
16                  }catch(e){
17                                          result.innerHTML="Onreadystate change error.";
18                  }
19
20                  try{
21                                         ajax.open("GET","//localhost:8000/cgi-bin/vemclient.rb?command="+encodeURIComponent(command)+"&max="+encodeURIComponent(max)+"&speed="+encodeURIComponent(speed)+"&place="+encodeURIComponent(place),true);
22                         //document.getElementById("detail").innerHTML="max:"+max;
23                                 }catch(e){
24                                         result.innerHTML = "ajax open error";
25                  }
26
27                                  try {
28                                  ajax.send(null);
29                                  }catch (e) {
30                                          result.innerHTML ="send error";
31                                  }
32
33         }else {
34                 result.innerHTML = "you cannot use ajax....";
35         }
36
37         function getData() {
38                         if (ajax.readyState==4) {
39                                         if (ajax.status==200) {
40                                                         var resultjson=ajax.responseText;
41                                                         resultjson=JSON.parse(resultjson);
42                                                         nmax.innerHTML = "max:"+resultjson['max'];
43                                                         nspeed.innerHTML="speed:"+resultjson['speed'];
44                                                         nplace.innerHTML="place:"+resultjson['place'];
45                                                  }else {
46                                                          result.innerHTML = "HTTP transmission....";
47                                                 }
48                          }
49         }
50  }
51
52
53
54