【发布时间】:2014-07-16 04:10:43
【问题描述】:
我有一个元素(在 html 中)
<image xlink:url="https://abc" id="my_ele">
我愿意
ele = document.getElementById("my_ele")
// Now want to get https://abc
这个答案在这里Getting 'xlink:href' attribute of the SVG <image> element dynamically using JS in HTML DOM
说:
getAttributeNS('http://www.w3.org/1999/xlink', 'href');
但我不确定在我的示例中这意味着什么。
(顺便说一句,Google 文档至少在 Chrome 中显示这样的图像。不知道他们为什么不使用正确的 IMG 标签。)
【问题讨论】:
-
在您的示例中将 href 更改为 url
标签: javascript html dom