Javascript 如何向SVG中的椭圆元素添加轮廓/边框?

Javascript 如何向SVG中的椭圆元素添加轮廓/边框?,javascript,jquery,svg,vector-graphics,jquery-svg,Javascript,Jquery,Svg,Vector Graphics,Jquery Svg,我是SVG的新手。我想知道在SVG代码中可以使用什么属性向椭圆元素添加轮廓/边框? 实际上,我正在尝试使用SVG和jQuery创建一个交互式图形,因此我需要让某些选定的椭圆元素在事件发生时显示特定颜色(如深红色)的实心轮廓。我想知道如何做到这一点 谢谢 你的意思是这样的吗 <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%"> <ellipse cx="30

我是SVG的新手。我想知道在SVG代码中可以使用什么属性向椭圆元素添加轮廓/边框? 实际上,我正在尝试使用SVG和jQuery创建一个交互式图形,因此我需要让某些选定的椭圆元素在事件发生时显示特定颜色(如深红色)的实心轮廓。我想知道如何做到这一点


谢谢

你的意思是这样的吗

<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
     width="100%" height="100%">
  <ellipse cx="300" cy="80" rx="100" ry="50"
  fill="yellow" stroke="purple" stroke-width="2"/>
</svg> 
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
     width="100%" height="100%">
  <ellipse cx="300" cy="80" rx="100" ry="50" fill="yellow"/>
  <rect x="200" y="30" width="200" height="100"
   fill="none" stroke="purple" stroke-width="2"/>
</svg> 

椭圆有一条紫色的边。或者你是说一个围绕椭圆的正方形盒子,你需要像这样分开做吗

<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
     width="100%" height="100%">
  <ellipse cx="300" cy="80" rx="100" ry="50"
  fill="yellow" stroke="purple" stroke-width="2"/>
</svg> 
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
     width="100%" height="100%">
  <ellipse cx="300" cy="80" rx="100" ry="50" fill="yellow"/>
  <rect x="200" y="30" width="200" height="100"
   fill="none" stroke="purple" stroke-width="2"/>
</svg> 


CSS中的
,类似于:

path {
  fill: none;;
  stroke: #646464;
  stroke-width:1px
  stroke-dasharray: 2,2;
  stroke-linejoin: round;
}

边境≈ 我指的是第一个。谢谢