-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlive.html
104 lines (74 loc) · 1.93 KB
/
live.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<html>
<head>
<script type="text/javascript">
xhr=false;
if(window.XMLHttpRequest)
{
xhr=new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
xhr=new ActiveXObject("Microsoft.XMLHTTP");
}
function getNames()
{
if(xhr)
{ url="http://127.0.0.1:9191/name";
xhr.open("GET",url);
xhr.onreadystatechange=callback;
xhr.send(null);
}
}
function callback()
{
if(xhr.readyState==4&&xhr.status==200)
{
call(xhr.responseText);
}
}
function call() {
if ((xhr.readyState == 4) && (xhr.status == 200)){
var arr = (xhr.responseText.trim()).split(",");
for(i=0;i<arr.length;i++)
{
arr[i] = arr[i].replace("\"","");
arr[i] = arr[i].replace("\"","");
arr[i] = arr[i].replace("[","");
arr[i] = arr[i].replace("]","");
document.getElementById('names').options[i] = new Option(arr[i],arr[i]);
// console.log(arr[i]);
}
}
}
function plot()
{
format="blank"
if(document.getElementById("c1").checked){ format="T20I"}
else if(document.getElementById("c2").checked){format="ODI"}
else if(document.getElementById("c3").checked){format="Test"}
url="http://127.0.0.1:9191/"+document.getElementById("typeofplot").value
url=url+"?name="+document.getElementById("names").value+"&format="+format;
//alert(url)
document.getElementById("plot1").src=url;
}
</script>
</head>
<body onload=getNames()>
<h1>R Is Very Powerful </h1>
<div>
<form id="f">
T20I<input id=c1 type="radio" name="format" value="T20I" onclick=plot() >
ODI<input id=c2 type="radio" name="format" value="ODI" onclick=plot()>
Test<input id=c3 type="radio" name="format" value="Test" onclick=plot()>
<br>
<select id="names">
</select><br>
<select id="typeofplot" size=12 onchange=plot()>
<option value=StrikeRateVsGround >Strike Rate Vs Ground</option>
<option value=StrikeRateVsGround>Strike Rate Vs Ground</option>
</select>
</form>
</div>
<img id="plot1" >
</body>
</html>