Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/11/2011, 13:09
Avatar de Franz1628
Franz1628
 
Fecha de Ingreso: marzo-2007
Ubicación: Lima - Perú
Mensajes: 145
Antigüedad: 18 años
Puntos: 26
Respuesta: Cambiar imagen de fondo de una celda html

Esta linea document.getElementById("td1").style.backgroundIma ge = "Template/Marino/lat_div_2.jpg"; debes cambiarla por document.getElementById("td1").style.backgroundIma ge = "url('Template/Marino/lat_div_2.jpg')";

Y debes de poner como atributo href del enlace el "#"

El código algo así
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  4. <title>Point - perfil</title>
  5.  
  6. <script type="text/javascript" language="javascript">
  7.  
  8. function cambiaImagen()
  9. {
  10.     document.getElementById("td1").style.backgroundImage = "url('Template/Marino/lat_div_2.jpg')";
  11. }
  12. </head>
  13.  
  14.  
  15. <table border="0" cellpadding="0">
  16.   <tr>
  17.     <td id="td1" width="90" height="102" background="Template/Marino/lat_div.jpg" >&nbsp;</td>
  18.   </tr>
  19.   <tr>
  20.     <td height="53" align="center"><a href="#" onClick="cambiaImagen();">Cambia Imagen</a></td>
  21.   </tr>
  22. </body>
  23.  
  24. </html>

Saludos
__________________
En mi Blog puedes ver articulos javascript y más...
@Franz1628