:: Forum >>

insert a image in a table column

I want to insert an image into HTML table. I am using a code similar to the following to create a HTML table.

var table = new AW.HTML.TABLE;
var row = new AW.HTML.TR;
var cell = new AW.HTML.TD;
cell.setContent("html", "some text");
row.setContent("cell", cell);
table.setContent("row", row);
table.setAttribute("border", "1");

Instead of having text in one cell, how to add an image?
cell.setContent("html", "some text");
I tried using setAttribute("image", "test.gif") and so on, but it did not work. Also I would need an event handler when that image is clicked.

Can you please let me know if we can have this capability in AW.HTML.TD and AW.HTML.TABLE?


Wednesday, March 25, 2009
I think I got it.
var img = new AW.HTML.IMG;
img.setAttribute("src", "/images/trash.gif");
img.setAttribute("onclick", "alert('working')");
cell.setContent("img", img);

Wednesday, March 25, 2009

This topic is archived.

Back to support forum

Forum search