JavaScript - No logro verla imagen

 
Vista:

No logro verla imagen

Publicado por aJaramillo (7 intervenciones) el 15/11/2011 21:10:18
Hola a tod@s,

Con este código:


<html>
<head>
<script type="text/javascript">
function addCell(par){
var x=document.getElementById('myTable');
var as = x.getElementsByTagName('td');
var y=x.rows[0].insertCell(par);
as[par].id="nuevo";
darAtributosBtn(as[par].id);
}

function darAtributosBtn(i) {
celda = document.getElementById(i);
celda.setAttribute("type","img");
celda.setAttribute("src","./gif/tool_add.gif");
celda.setAttribute("width","15px");
celda.setAttribute("height","15px");
celda.setAttribute("onClick","alerta();");
}

function alerta() {
alert("LLEGO");
}
</script>
</head>

<body>
<form>
<table id="myTable" border="1">
<tbody>
<tr>
<td id="uno">Celda uno<img src="./gif/tool_add.gif" onClick="addCell(1);"></td>
<td id="dos">Celda dos</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>


La idea es insertar una celda entre las dos existentes. Esta nueva celda ha de contener una imagen. La celda efectivamente se crea, es mas, haciendo click en el espacio que me crea (nueva celda) se activa la función alertar.... Solo me falta ver la imagen

Colo lo hago?

Gracias de antemano por su ayuda

Un Cordial Saludo
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