Hi! I need to extend the Adobe SVG Viewer context menu for auto-generated SVG files in an external javascript. I've already added the needed tags into the document using DOM like
<defs> <menu id="annotate"> <header>RDF Menu</header> <item action="ZoomIn">Zoom &In</item> <item action="ZoomOut">Zoom &Out</item> <item action="OriginalView">&Original View</item> <item/> <item onactivate="myFunction(evt)">&My Function</item> ... ... </menu> </defs> Now my problem is to set up a function to parse the new menu: I could write the method in my external javascript file like function parseMenu(svg) { var svgDoc = svg.getSVGDocument(); var svgRootDoc = svgDoc.getRootElement(); var newMenuRoot = parseXML(printNode(svgRootDoc.getElementById("annotationMenu")), contextMenu); contextMenu.replaceChild(newMenuRoot, contextMenu.firstChild); } The Problem with this is that I don't have access to "contextMenu", so I get error messages when the function is called... The other possibility would be to add the function to the SVG document just like the tags for the menu itself: script = svgDoc.createElement("script"); text = svgDoc.createTextNode("function parseMenu() {var newMenuRoot = parseXML(printNode(svgRootDoc.getElementById( \"annotationMenu\")), contextMenu);contextMenu.replaceChild(newMenuRoot, contextMenu.firstChild);}"); script.appendChild(text); svgDocRoot.appendChild(script); Doing this i get a Javascript error saying "Object expected" after calling the parseMenu() function. I think this means he can't find the corresponding function definition. I can't figure out how to get this going, would be great if anyone could help me with this. Cheers, Jochen ------------------------ Yahoo! Groups Sponsor --------------------~--> Most low income households are not online. Help bridge the digital divide today! http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/1U_rlB/TM --------------------------------------------------------------------~-> ----- To unsubscribe send a message to: [EMAIL PROTECTED] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ---- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/