Jscript image tag creation gives an error -
function pushimage () { var img = new image(); img.src = '/waroot/chart/chart.png'; document.getelementbyid("test1").innerhtml = "<img src='/waroot/chart/chart.png'>"; document.getelementbyid("test2").innerhtml = img; }
test 1 works , shows image, test 2 doesn't. not sure how solve need way test 2 works further along project since i'm going have circle through large amount of images.
the images created jfreecharts
, saved png
, have posted site. side question: possible push freecharts objects straight jscript
instead of having save them prior (i throw them dictionary , them later i'm not sure if works)
use .appendchild(img)
instead of .innerhtml
:
function pushimage () { var img = new image(); img.src = '/waroot/chart/chart.png'; document.getelementbyid("test1").innerhtml = "<img src='/waroot/chart/chart.png'>"; document.getelementbyid("test2").appendchild(img); }
this because img
image object, not html string, have append dom.
p.s., don't forget alt
attribute required in img
tag!
Comments
Post a Comment