HTML
<svg>
<polyline points="0,0 100,100" style="fill:none;stroke:black;stroke-width:3"/>
</svg>
jquery的
$("svg").css("width",$(document).width());
$("svg").css("height",$(document).height()-10);
$("polyline").click(function(){
alert($(this).attr("points"));
});
结果
&lt; - alert - &gt;
对象SvgPointList
问题
如何获得atv svg积分?
答案 0 :(得分:0)
为什么不尝试使用简单的javascript获取'points'属性
我正在为折线提供ID
<polyline id="polyline_1" points="0,0 100,100" style="fill:none;stroke:black;stroke-width:3"/>
现在Javascript: -
var polyline =document.getElementById('polyline_1');
var points=polyline.getAttribute('points');
它将返回字符串。