Put a Javascript variable into a innerHTML code -


i'm creating table dynamic table javascript:

var row = table.insertrow(-1); var cell1 = row.insertcell(0); var cell2 = row.insertcell(1); var cell3 = row.insertcell(2); var cell4 = row.insertcell(3); var cell5 = row.insertcell(4); 

i want fill cell5 innerhtml javascript variable inside

var add = aux[i].split("#"); cell5.innerhtml = "<img src='matrixlogos/add[3]' width='100' height='25'/>"; 

but give add[3] in html instead of value inside add[3].

my question how escape variable inside innerhtml code, shows me value , not declaration.

use "+".

var add = aux[i].split("#"); cell5.innerhtml = "<img src='matrixlogos/"+add[3]+"' width='100' height='25'/>"; 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -