获取/设置属性
obj.attr(name,[value])
<!DOCTYPE html>
<html>
<head>
<title>d3</title>
<meta charset="utf-8">
<script src='node_modules/d3/d3.min.js'></script>
<script type="text/javascript">
window.onload=()=>{
// alert(d3.selectAll('p').attr('index'))//111默认选的是第一个
d3.selectAll('p').attr('class','active')
}
</script>
</head>
<body>
<p index='111'>hello world</p>
<p index='222'>111111111111</p>
<span>dsafas</span>
<p index='333'>welcome</p>
</body>
</html>