Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/07/2012, 22:23
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: No se solucionar un error que sale en Chtome

Probablemente estés invocando la función antes de cargar el body

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2.    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <title>titulo</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. <script type="text/javascript">
  7. //<![CDATA[
  8. function agregar_al_body() {
  9.     var t_span = document.createElement("span");
  10.     var texto = document.createTextNode("Texto e span.....");
  11.     t_span.appendChild(texto);
  12.     document.body.appendChild(t_span);
  13.      }
  14. window.onload = agregar_al_body; // el body debe cargarse antes de hacer el appendChild
  15. //]]>
  16. </head>
  17. </body>
  18. </html>

substituí el span por tu imagen

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.