两个文件放在同一目录
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svg主文件
tt.svg
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
"http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
getURL("yy.xml", fileLoaded);
function fileLoaded (data) {
var msg = '';
if(data.success) {
var newMenuRoot=parseXML(data.content,contextMenu);
contextMenu.replaceChild(newMenuRoot,contextMenu.getDocumentElement());
}
}
var target;
function onmousedown(evt){
if(evt.button==2) target=evt.getTarget();
}
function showAlert(evt){
if(target!=null)
{
alert(target.getAttribute("id"));
}
target=null;
<