Ayuda con img y button
Publicado por Anangela (4 intervenciones) el 29/06/2017 23:29:17
Soy nueva en la programación web, y tengo un proyecto de hacer un juego de tenis con javascript. Estoy tratando de insertar una imagen en un div y un boton en otro pero no me salen. Agradecería mucho su ayuda.
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
function DivPelota(){
dPt= crearElemento("div");
dPt.style.position= "absolute";
dPt.style.display="block";
dPt.style.left="475px";
dPt.style.top="350px";
dPt.style.width="50px";
dPt.style.height="50px";
dPt.style.backgroundColor="rgba(255,255,0,0.5)";
dCp.appendChild(dPt);
//Inserto una imagen de pelota
ima=crearElemento("img");
ima.setAttribute("src","tennis1.png");
ima.style.width="20px";
ima.style.height="20px";
dPt.appendChild(ima);
}
//Botones de Star y Stop
function DivBotones(){
var dbv= crearElemento("div");
dbv.style.position="absolute";
dbv.style.display="block";
dbv.style.left="1520px";
dbv.style.top="200px";
dbv.style.width="100px";
dbv.style.height="50px";
dbv.style.backgroundColor="rgba(255,255,0,0.5)";
document.body.appendChild(dbv);
db1= crearElemento("input");
db1.type= 'button';
db1.id= 'botonStart';
db1.value= 'Start';
dbv.appendChild(db1);
}
Valora esta pregunta
0