Ver Mensaje Individual
  #3 (permalink)  
Antiguo 22/07/2009, 06:11
Protegon
 
Fecha de Ingreso: mayo-2007
Mensajes: 12
Antigüedad: 17 años
Puntos: 0
Respuesta: InnerHtml en vez de textnode ¿cómo hacerlo?

Cita:
Iniciado por Didi-chan Ver Mensaje
Creo que deberia ser así, prueba a ver. Aunque no entiendo que pretendes preguntandole eso al if...

Código:
<script type="text/javascript">
function addtext(what){
if (document.innerHTML){
document.getElementById("mydiv").innerHTML = what;
}
}
</script>
<div id="mydiv" onClick="addtext(' This Text was added to the DIV.<br /> adasda')" style="font:20px bold; cursor:hand">Click here for example</div>
Le quité el if y he hecho lo que me haz dicho

Código:
<script type="text/javascript">
function addtext(what){

document.getElementById("mydiv").innerHTML = what;
}

</script>
<div id="mydiv" href="javascript:void(0)" onClick="addtext('This Text was added to the DIV.<br /> adasda')" style="font:20px bold; cursor:hand">Click here for example</div>
y me ha servido demasiado bien men, te agradezco la ayuda a este noob.

GRACIAS!