-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
45 lines (38 loc) · 1.36 KB
/
index.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
<!DOCTYPE html> <!-- este es un comentario, aqui se indica que es un doc-->
<html> <!--- aqui empieza en html-->
<head> <!-- aqui va la info de la pagina-->
<title> my firs javascript page </title> <!--- titulo de la pagina-->
</head>
<body> <!-- lo que se mostrara en la pagina-->
<h1 id="mititulo" onmousemove="cambiaColor()" ></h1>
<button onclick="cambiaColor()"> cambia el color</button>
</body>
</html>
<script type="text/javascript">
var saludo = "hola Mamasita!!"
const titulo = document.getElementById("mititulo")
titulo.innerHTML = saludo
titulo.style.fontSize = "50px"
titulo.style.color = "purple"
titulo.style.backgroundColor = "yellow"
titulo.style.fontStyle = "bold"
titulo.style.textDecoration = "underline"
function cambiaColor(){
var color = "#"
for (var i = 0; i < 6; i++) {
color += colorAleatorio()
}
titulo.style.color = color
var color2 = "#"
for (var i = 0; i < 6; i++) {
color2 += colorAleatorio()
}
titulo.style.backgroundColor = color2
console.info(color)
}
function colorAleatorio(){
const hexa = ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"]
var numero = (Math.random()*15).toFixed(0)
return hexa[numero]
}
</script>