I am trying to display an image in a table. This is what I have tried:
imgv = "/img/koala.jpg"; dcontent = "<table style='background-color:purple;'><tr><td style='width: 100px; color: red;'> Date </td>"; dcontent += "<tr><td style='width: 100px;'><img src="' + imgv + '"/></td>";
I am getting a compile time error in the second line:
“; expected”.
I tried many syntax like:
<img src=" + imgv + "/></td>
but nothing is getting compiled.
Advertisement
Answer
Correct answer is replacing "' + imgv + '"
with '" + imgv + "'
imgv = "/img/koala.jpg"; dcontent = '<table style="background-color:purple;"><tr><td style="width: 100px; color: red;"> Date </td>'; dcontent += "<tr><td style='width: 100px;'><img src='" + imgv + "'/></td>";