使用以下 Raphael SVG 代码,我可以更改文本的颜色,但不能更改文本本身:
function create_Star_Icons(){
var container = Raphael(feedback_Icons, 500, 70);
var star_Icons = container.set();
star_Icons.push(
container.text(60,32,"Punctuality"),
container.path("M28.631,12.359c-0.268-0.826-1.036-1.382-1.903-1.382h-0.015l-7.15,0.056l-2.155-6.816c-0.262-0.831-1.035-1.397-1.906-1.397s-1.645,0.566-1.906,1.397l-2.157,6.816l-7.15-0.056H4.273c-0.868,0-1.636,0.556-1.904,1.382c-0.27,0.831,0.029,1.737,0.74,2.246l5.815,4.158l-2.26,6.783c-0.276,0.828,0.017,1.739,0.723,2.25c0.351,0.256,0.763,0.384,1.175,0.384c0.418,0,0.834-0.132,1.189-0.392l5.751-4.247l5.751,4.247c0.354,0.26,0.771,0.392,1.189,0.392c0.412,0,0.826-0.128,1.177-0.384c0.704-0.513,0.997-1.424,0.721-2.25l-2.263-6.783l5.815-4.158C28.603,14.097,28.901,13.19,28.631,12.359zM19.712,17.996l2.729,8.184l-6.94-5.125L8.56,26.18l2.729-8.184l-7.019-5.018l8.627,0.066L15.5,4.82l2.603,8.225l8.627-0.066L19.712,17.996z"),
container.text(17,18,"7"),
container.text(210,32,"Intensity"),
container.path("M28.631,12.359c-0.268-0.826-1.036-1.382-1.903-1.382h-0.015l-7.15,0.056l-2.155-6.816c-0.262-0.831-1.035-1.397-1.906-1.397s-1.645,0.566-1.906,1.397l-2.157,6.816l-7.15-0.056H4.273c-0.868,0-1.636,0.556-1.904,1.382c-0.27,0.831,0.029,1.737,0.74,2.246l5.815,4.158l-2.26,6.783c-0.276,0.828,0.017,1.739,0.723,2.25c0.351,0.256,0.763,0.384,1.175,0.384c0.418,0,0.834-0.132,1.189-0.392l5.751-4.247l5.751,4.247c0.354,0.26,0.771,0.392,1.189,0.392c0.412,0,0.826-0.128,1.177-0.384c0.704-0.513,0.997-1.424,0.721-2.25l-2.263-6.783l5.815-4.158C28.603,14.097,28.901,13.19,28.631,12.359zM19.712,17.996l2.729,8.184l-6.94-5.125L8.56,26.18l2.729-8.184l-7.019-5.018l8.627,0.066L15.5,4.82l2.603,8.225l8.627-0.066L19.712,17.996z"),
container.text(17,18,"7"),
container.text(380,32,"Enjoyment"),
container.path("M28.631,12.359c-0.268-0.826-1.036-1.382-1.903-1.382h-0.015l-7.15,0.056l-2.155-6.816c-0.262-0.831-1.035-1.397-1.906-1.397s-1.645,0.566-1.906,1.397l-2.157,6.816l-7.15-0.056H4.273c-0.868,0-1.636,0.556-1.904,1.382c-0.27,0.831,0.029,1.737,0.74,2.246l5.815,4.158l-2.26,6.783c-0.276,0.828,0.017,1.739,0.723,2.25c0.351,0.256,0.763,0.384,1.175,0.384c0.418,0,0.834-0.132,1.189-0.392l5.751-4.247l5.751,4.247c0.354,0.26,0.771,0.392,1.189,0.392c0.412,0,0.826-0.128,1.177-0.384c0.704-0.513,0.997-1.424,0.721-2.25l-2.263-6.783l5.815-4.158C28.603,14.097,28.901,13.19,28.631,12.359zM19.712,17.996l2.729,8.184l-6.94-5.125L8.56,26.18l2.729-8.184l-7.019-5.018l8.627,0.066L15.5,4.82l2.603,8.225l8.627-0.066L19.712,17.996z"),
container.text(17,18,"7")
);
// formatting
star_Icons[0].attr({"font-family": "Calibri, Arial, sans-serif","font-size": 18,"font-weight":"bold",fill: "#808080"}); // label
star_Icons[1].attr({fill: "#b2b2b2", stroke: "none"}); // star
star_Icons[2].attr({"font-family": "Arial Black, sans-serif","font-size": 12,"font-weight":"bold",fill: "#ff0000"}); // number
star_Icons[3].attr({"font-family": "Calibri, Arial, sans-serif","font-size": 18,"font-weight":"bold",fill: "#808080"}); // label
star_Icons[4].attr({fill: "#b2b2b2", stroke: "none"}); // star
star_Icons[5].attr({"font-family": "Arial Black, sans-serif","font-size": 12,"font-weight":"bold",fill: "#ff0000"}); // number
star_Icons[6].attr({"font-family": "Calibri, Arial, sans-serif","font-size": 18,"font-weight":"bold",fill: "#808080"}); // label
star_Icons[7].attr({fill: "#b2b2b2", stroke: "none"}); // star
star_Icons[8].attr({"font-family": "Arial Black, sans-serif","font-size": 12,"font-weight":"bold",fill: "#ff0000"}); // number
// positioning
star_Icons[0].transform("t0,0"); // label
star_Icons[1].transform("t120,20s1.75"); // star
star_Icons[2].transform("t120,20s1.75"); // number
star_Icons[3].transform("t0,0"); // label
star_Icons[4].transform("t280,20s1.75"); // star
star_Icons[5].transform("t280,20s1.75"); // number
star_Icons[6].transform("t0,0"); // label
star_Icons[7].transform("t440,20s1.75"); // star
star_Icons[8].transform("t440,20s1.75"); // number
// id's and classess
star_Icons[1].node.setAttribute("class", "punctuality_Star");
star_Icons[2].node.setAttribute("class", "punctuality_Num");
star_Icons[4].node.setAttribute("class", "intensity_Star");
star_Icons[5].node.setAttribute("class", "intensity_Num");
star_Icons[7].node.setAttribute("class", "enjoyment_Star");
star_Icons[8].node.setAttribute("class", "enjoyment_Num");
} // create_Star_Icons
正在使用以下 jquery:
$(".punctuality_Num").attr("fill","#00ffff");
$(".punctuality_Num").attr("text","1");
任何想法为什么这不会更新?想知道是不是因为它在一个集合中,这是否意味着需要以不同的方式访问文本元素。
编辑 - 重要
我忘了说在 Firefox 上的 HTML 查看器中看到的文本确实发生了变化。但是你看到的并没有改变