-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2.html
64 lines (54 loc) · 1.23 KB
/
2.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
<html>
<head>
<title>Home</title>
<style>
body{
background-color: "#0000FF";
text-align: center;
}
.displaybox{
color: rgb(0,0,255);
margin: auto;
width: 1000px;
border: 2px solid #000000;
padding: 10px;
align: center;
font: 1.5em normal verdana, helvetica, arial;
}
</style>
<script>
var ajaxobject=new XMLHttpRequest();
function vote() {
if(!ajaxobject)
{
document.getElementById("showstudent").innerHTML="AJAX obejct could not be created";
return;
}
ajaxobject.open("GET","1.php");
ajaxobject.send();
ajaxobject.onreadystatechange=getResponse;
}
function getResponse(){
if(ajaxobject.readyState == 4 && ajaxobject.status == 200)
{
document.getElementById('showstudent').innerHTML=ajaxobject.responseText;
}
}
function result()
{
document.getElementById("shows").innerHTML=document.getElementById("list").elements['vote'].value;
}
</script>
</head>
<body>
<input type="button" value="click for vote"onclick="vote()"/>
<div id="showstudent" class="displaybox">
</div>
<input type="button" value="Result" onclick="result()">
<div id="shows" class="displaybox" >
</div>
<input type="button" value="submit" onclick="result()">
<div id="shows" class="re" >
</div>
</body>
</html>