-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
47 lines (38 loc) · 882 Bytes
/
main.js
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
var trial=document.getElementById('trial');
var btn=document.getElementById('btn1');
var b=document.getElementById('counter');
var left=0;
var i=0;
function moveRight()
{
left=left+10;
trial.style.marginLeft=left+'px';
if (left === 1450) {
left = 0;
}
console.log('value = '+left);
}
btn.onclick=function()
{
trial.style.marginLeft='0px';
var interval=setInterval(moveRight,50);
};
var counter=0;
b.onclick=function () {
//j=j+1;
//console.log('value is '+j);
//var request=new XMLHttpRequest();
//request.onreadystatechange=function() {
//if(request.readyState===XMLHttpRequest.DONE){
//if(request.status===200)
//{
//var j=request.responseText;
counter=counter+1;
var span=document.getElementById('count');
span.innerHTML=counter.toString();
//}
//}
//}
//request.open('GET','localhost:8000/counter');
//request.send(null);
};