-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmix.js
More file actions
45 lines (42 loc) · 1.35 KB
/
mix.js
File metadata and controls
45 lines (42 loc) · 1.35 KB
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
function change(){
var x=document.getElementById("aqui").src;
if (x=="file:///C:/Users/inlab/Documents/GitHub/js/colores/red.png") document.getElementById("aqui").src="colores/blue.png";
else if (x=="file:///C:/Users/inlab/Documents/GitHub/js/colores/blue.png") document.getElementById("aqui").src="colores/green.png"
else document.getElementById("aqui").src="colores/red.png";
}
function sum(){
var x=document.getElementById("second").innerHTML;
++x;
if (x==60){
x=0;
var y=document.getElementById("minute").innerHTML;
++y;
if (y==60){
y=0;
var z=document.getElementById("hour").innerHTML;
++z;
if (z==24) z=0;
if (z<10) document.getElementById("hour").innerHTML='0'+z;
else document.getElementById("hour").innerHTML=z;
}
if (y<10) document.getElementById("minute").innerHTML='0'+y;
else document.getElementById("minute").innerHTML=y;
}
if (x<10) document.getElementById("second").innerHTML='0'+x;
else document.getElementById("second").innerHTML=x;
}
function greet(){
var x=document.getElementById("name").value;
if (x!=""){
document.getElementById("greet").innerHTML="Hola "+x;
}
else{
document.getElementById("greet").innerHTML="Invalid name";
}
document.getElementById("name").value=null;
}
window.onload=function(){
setInterval(change,250);
setInterval(sum,1000);
document.getElementById("button").onclick = greet;
}