HTML - Cambiar de un color de fondo que es azul a una imagen al presionar un boton en Dreamweaver

 
Vista:

Cambiar de un color de fondo que es azul a una imagen al presionar un boton en Dreamweaver

Publicado por Juan (1 intervención) el 12/11/2016 02:18:54
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
 
 
 
<style type="text/css">
#capa {
	background-color: #00F;
	height: 350px;
	width: 250px;
	color: #FFF;
 
}
</style>
 
<script type="text/javascript">
function cambio(){
document.getElementById('capa').style.backgroundImage='imagenes/images.jpg';
document.getElementById('capa').style.width='300px';
document.getElementById('capa').style.height='400px';
}
</script>
 
</head>
<body>
 
<div id="capa"></div>
<p>
  <input type="submit" name="boton" id="boton" value="Cambiar" onclick="cambio()" />
</p>
</body>
</html>

----> No se donde esta el error me podrian ayudar x favor
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Alejandro
Val: 247
Bronce
Ha mantenido su posición en HTML (en relación al último mes)
Gráfica de HTML

Cambiar de un color de fondo que es azul a una imagen al presionar un boton en Dreamweaver

Publicado por Alejandro (100 intervenciones) el 12/11/2016 15:35:28
  • Alejandro se encuentra ahora conectado en el
  • chat de PHP
Esto esta mal
1
document.getElementById('capa').style.backgroundImage='imagenes/images.jpg';

va así
1
document.getElementById('capa').style.backgroundImage='url("imagenes/images.jpg")';
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar