<!DOCTYPE html> <html> <head> <title></title> <script type="text/javascript" src="http://su.bdimg.com/static/superplus/js/lib/jquery-1.10.2_d88366fd.js"></script> <script type="text/javascript"> $(function() { var img_str = "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" $("#img").attr("src", "data:image/png; base64," + img_str); }); </script> </head> <body> <img id="img" src=""> </body> </html>
?
javascript直接把base64的字符串转换成图片显示在网页上的方法
原文:http://wudixiaotie.iteye.com/blog/2157239