i want to add image inside a span
here’s what i tried (inside a form i added this script):
<script language="JavaScript">
function addSelected(){
var content=" <img src='/resources/images/image.bmp'/> ";
var span = document.getElementById("members");
span.innerHTML=content;
}
</script>
but it always gives me the error:
unterminated string literal
on this line:
var content=" <img src='/resources/images/image.bmp'/> ";
because it’s translated by browser to something like (found that by firebug):
var content=" <img src="/resources/images/CONTACTS.bmp" /> ";
this is tested on firefox 8.
And what about this:
This the standard way of adding elements to the DOM using DOM itself. And you avoid these kind of problems.