<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg οnlοad="initDocument(evt)"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<defs>
<menu id='newMenu'> /* 定义新菜单 */
<header>Custom Menu</header>
<item action='ZoomIn'>Zoom In</item>
<item action='ZoomOut'>Zoom Out </item>
<separator/> /* 定义分割符 */
<menu> /* 定义子菜单 */
<header>Submenu</header>
<item xlink:href="http://www.163.net" target="window">Link</item>
<item onactivate="alert('hello')">hello</item>
</menu>
</menu>
</defs>
<script type="text/javascript" ><![CDATA[
function initDocument(evt) {
if ( window.svgDocument == null )
svgDocument = evt.target.ownerDocument;
var newMenuRoot = parseXML( printNode(document.getElementById('newMenu')),
contextMenu);
contextMenu.replaceChild(newMenuRoot, contextMenu.firstChild);
}
]]></script>
<rect x="0" y="0" width="400" height="400" fill="skyblue" />
</svg>