
por que no funciona!!! cambiar el color del body
Publicado por anonymous (50 intervenciones) el 27/06/2016 06:24:25
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
<!-- el problema es que no se como llegar a el h1 de todos los body que sea como css que haces
div h1 { background=#fff;} -->
<!DOCTYPE html>
<html>
<head>
<title>editar web js</title>
</head>
<script>
function style(){
document.config.fcolor.style.width="150px";
document.config.fcolor.style.height="150px";
}
function cfondo(){
var color = document.config.fcolor.value;
var i;
for (i = 0; i < x.length; i++) {
document.getElementsByTagName('div')[i].getElementsByTagName('h1')[i].style.background=color;
}
}
</script>
<body onload="style();cfondo()">
<div>
<h1>hola</h1>
<h1>hola</h1>
<h1>hola</h1>
</div>
<form name="config">
<input type="color"name="fcolor" value="#fff" onchange="cfondo()">
</form>
</body>
</html>
Valora esta pregunta


0