1
は、私が円を作成しようとする方法である:最初にそこにハードコードされたJavaScriptから作成されたsvg要素が表示されないのはなぜですか?ここ
var svgns = "http://www.w3.org/2000/svg/";
var circle = function(x, y) {
this.x = x;
this.y = y;
this.element = document.createElementNS(
svgns, "circle"
);
this.element.setAttributeNS(null, "cx", x);
this.element.setAttributeNS(null, "cy", y);
this.element.setAttributeNS(null, "r", CIRCLE_RADIUS);
this.element.setAttributeNS(null, "fill", randomColor());
svg.appendChild(this.element);
}
circle(100, 100);
のみの円が表示されます。二つの別の、私のスクリプトによって追加された は表示されませんが、デベロッパーツールでシードとして、彼らは、ほとんどidenticaです:
ここではCodePenへのリンクです。たぶん私はいくつかの名前空間やスタイルや何かを台無しにしましたか?
- > '/'終わり – Weedoze
を除去して、これは正しいです –