You may want to rephrase your question, as "accept an image" doesn't mean anything specific.
I can think of three things you might mean:
The caller of the function passes in the URL of an image, and wants that image to be rendered instead of a hyperlink. In which case you could just set:
s.textb = unescape('<img src="' + imgParameter + '"></img>');
The caller passes in the URL of an image to use as the contents of the hyperlink. In which case you'd basically put the above unescaped code between the existing anchor tags:
s.textb = unescape('<a href="http://www.link.com" target="_blank"><img src="' + imgParameter + '"></img></a>');
One of the above options but taking a Javascript Image object instead of the URL; in which case, you extract the URL from the image via image.src and then proceed with one of the above options.
If none of these cover your case, then please clarify what you meant, perhaps with a pseudocode example. Don't forget to say what the expected output is rather than "it doesn't work". :-)