2
我在SVG中動態地將<title>
插入到我的組中,但其效果不起作用。該元素被添加到適當的位置和一切,但我的組沒有得到一個工具提示。手動插入到SVG中的元素起作用。爲什麼我的動態插入的不是?<title>插入到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/
請張貼代碼在實際的問題。 – Doorknob