<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SVGdom绘制圆形</title>
<style>
#circle{
width: 100px;
height: 100px;
border: 1px solid red;
}
</style>
<script>
function createCircle(){
var root=document.getElementByIdx_x("circle");
var SVG="http://www.w3.org/2000/svg";
//创建SVG元素
var svg=document_createElement_xNS(SVG,"svg");
svg.setAttribute("width","100");
svg.setAttribute("height","100");
//创建我们的circle元素
var circle=document_createElement_xNS(SVG,"circle");
circle.setAttribute("cx","50");
circle.setAttribute("cy","50");
circle.setAttribute("r","40");
svg.a(circle);
root.a(svg);
}
</script>
</head>
<body οnlοad="createCircle()">
<h4>SVGdom绘制圆形</h4>
<div id="circle"></div>
</body>
</html>