Using document.writeln()

I’m sorry if this question seem very basic but I just start learning javascript.
I would like to display an image but not sure why it is not working. In a nutshell, here’s my code


<script type="text/javascript">
document.writeln("<img src=/"xMark.jpg /" width=25 height=25 >");


Does the filename really have a space on the end after the .jpg? If not then removing that space from your code might help.

Also replacing the two / with \ so as to properly escape the " will also help or alternatively just get rid of them completely and surround the whole string with ’ instead of " so that they don’t need to be escaped.

I’ve tried single quote like you suggested and it works great.

document.writeln(‘<img src=“xMark.jpg” width=“20” height=“20”>’);

thank you