<svg width="200" height="100"> <script><![CDATA[ var
textNode = null; var shape = null; function
change_text(evt) { if
(textNode != null) { textNode.setAttribute("fill",
"blue");
var
parent = shape.parentNode; parent.removeChild(shape); } textNode
= evt.getTarget(); textNode.setAttribute("fill",
"red");
// ½Å±Ô } function
add_rect(evt) { change_text(evt) var
SVGDoc = evt.getTarget().getOwnerDocument(); var
SVGRoot = SVGDoc.getDocumentElement(); shape
= SVGDoc.createElement("rect"); shape.setAttribute("x",
20); shape.setAttribute("y",
20); shape.setAttribute("width",60); shape.setAttribute("height",
60); shape.setAttribute("fill",
"yellow"); shape.setAttribute("stroke",
"magenta"); SVGRoot.appendChild(shape); } function
add_line(evt) { ... shape
= SVGDoc.createElement("line"); shape.setAttribute("x1",
20); ... } function add_polygon(evt)
{ change_text(evt) ... shape
= SVGDoc.createElement("polygon"); shape.setAttribute("points",
"20,20 80,80, 20,80 80,20"); shape.setAttribute("fill",
"cyan"); shape.setAttribute("stroke",
"magenta"); SVGRoot.appendChild(shape); } function
add_path(evt) { ... shape
= SVGDoc.createElement("path"); shape.setAttribute("d",
"M20,20 C20,80 80,80, 80,20"); shape.setAttribute("fill",
"pink"); ... } ]]></script> <text
x="100" y="20" style="font-size:16;
font-family:Verdana" fill="blue"
onclick="add_rect(evt)"
> rectangle </text> <text
x="100" y="40" style="font-size:16;
font-family:Verdana" fill="blue"
onclick="add_line(evt)"
> line </text> <text
x="100" y="60" ... fill="blue" onclick="add_polygon(evt)"
> polygon </text> <text
x="100" y="80" ... fill="blue" onclick="add_path(evt)"
> path </text> </svg>
|
¸Þ´º ÅؽºÆ® °´Ã¼ µµÇü °´Ã¼
¸Þ´º
ÅؽºÆ® ÆĶõ»öÀ¸·Î ±âÁ¸ °´Ã¼´Â »èÁ¦
¼±ÅõÈ
ÅؽºÆ®´Â »¡°£»ö
»ç°¢Çü ½Å±Ô »ý¼ºÇϱâ - ¿ì¼± ÅؽºÆ®
»ö»ó º¯°æ
- »ç°¢Çü »ý¼º
¼±ºÐ
½Å±Ô »ý¼ºÇϱâ
´Ù°¢Çü ½Å±Ô »ý¼ºÇϱâ
path
½Å±Ô »ý¼ºÇϱâ
|