Click here to Skip to main content
15,609,235 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Guys,

can any one help me to the above topic.

1) I am getting an image in the format base64String from an applet.
2) I am storing that in javascript variable.
3) There is a button in the HTML page, i had created a javascript function which will be executed when that button is pressed.

Now i want to place that image in an image tag in the same html page when pressing the same button.

var docImage :- contains the Base64 string
doc_image : - is the image tag name.

i tried this code snippet
document.getElementById('doc_image').src = "data:image/png,base64," ' + docImage +';

need help :)


Instead of this:
document.getElementById('doc_image').src = "data:image/png,base64," ' + docImage +';

Try this:
document.getElementById('doc_image').src = "data:image/png;base64,"  + docImage;

Hope this helps.
Share this answer
Thank you dude,

Its working.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900