admin管理员组文章数量:1386806
I am new to svg. I have two svg images i need to append link around the path in one svg image, onclicking that path i should navigate to another svg image.
<svg id="svg1" xmlns="" xmlns:xlink="" >
<g id="path1">
<a xlink:href="" target="_top">
<path id="parcel" />
</a>
</g>
</svg>
How should i get attribute into my application(html) and append href link to it using javascript. Thanks in advance
I am new to svg. I have two svg images i need to append link around the path in one svg image, onclicking that path i should navigate to another svg image.
<svg id="svg1" xmlns="http://www.w3/2000/svg" xmlns:xlink="http://www.w3/1999/xlink" >
<g id="path1">
<a xlink:href="" target="_top">
<path id="parcel" />
</a>
</g>
</svg>
How should i get attribute into my application(html) and append href link to it using javascript. Thanks in advance
Share Improve this question asked Dec 15, 2014 at 7:34 user2083041user2083041 5231 gold badge10 silver badges32 bronze badges1 Answer
Reset to default 5Get a reference to the <a>
element using whichever method you choose. For example
<a id="mylink" xlink:href="" target="_top">
<path id="parcel" />
</a>
var mylink = document.getElementById("mylink");
Then you can set the xlink:href
attribute using:
mylink.setAttributeNS('http://www.w3/1999/xlink', 'xlink:href',
'http://www.google.');
本文标签: How to add ltagt link to svg path to navigate to another svg image using javascriptStack Overflow
版权声明:本文标题:How to add <a> link to svg path to navigate to another svg image using javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744574604a2613545.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论