我<title>在 SVG 中动态地将 a 插入到我的组中,但是它的效果不起作用。该元素被添加到适当的位置和所有内容,但我的小组没有得到工具提示。手动插入到 SVG 作品中的相同元素。为什么我的动态插入的不是?
function setuptooltip() {
    var shadowlegs = document.getElementById('shadow-legs');
    var title      = document.createElement('title');
    var titletext  = document.createTextNode("Hi there and greetings!");
    title.appendChild(titletext);
    // get the first child of shadowlegs, so we can insert before it
    var firchild = shadowlegs.firstChild;
    // insert before the first child
    shadowlegs.insertBefore(title, firchild);
}
这是代码:http : //jsfiddle.net/bYjva/
你不是在创建一个合适的 SVG 元素,而是一个 DOM 元素,你必须这样做
var title = document.createElementNS('http://www.w3.org/2000/svg', 'title');
| 归档时间: | 
 | 
| 查看次数: | 348 次 | 
| 最近记录: |