javascript - Change font color after createElementNS() -
im building game , seek display highscores @ end. current username should highlighted different color can't work. when tried alter fontsize testing purposes workes though!
var namespan = svgdoc.createelementns("http://www.w3.org/2000/svg", "tspan"); namespan.setattribute("x", 130); namespan.setattribute("dy", 30); var nametextnode = svgdoc.createtextnode(record.name); if (record.name == playername){ namespan.style.fontcolor = "red"; // not work namespan.style.color = "blue"; // not work namespan.style.fontsize = "100px"; // works fine } namespan.appendchild(nametextnode);
i tried different ways apply color(2 of them can seen above) stays black time.
svg text not coloured using color. instead uses fill , stroke can colour outline separately. alter things namespan.style.fill = "blue"
, should work you.
javascript svg
No comments:
Post a Comment