我试图让一些基本的ecma脚本在我有的svg文档中工作。svg脚本故障
<svg contentScriptType="text/ecmascript" width="957px"
xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify"
contentStyleType="text/css" viewBox="-2998 -1920 6580 5780" height="841px"
preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg"
version="1.1" onload="init(evt)"">
<script type = "text/ecmascript">
<![CDATA[
function init(evt) {
if (window.svgDocument == null) {
svgDoc = evt.target.ownerDocument;
}
}
function displayName(name) {
svgDoc.getElementById("node_name").firstChild.data = name;
}
]]> </script>
<text class = "label" id = "node_name" x="10" y="390"></text>
<circle fill-opacity="0.2" fill="#3ccb5d" r="40.0" cx="1568.2628"
class="46960" cy="-1518.6278" stroke="#000000"
stroke-opacity="0.5" stroke-width="1.0"
onmouseover="displayName('Showing Nodes')"/>
</svg>
对于每次我试图从这一圆圈里触发显示名事件时间由于某种原因,虽然,我得到我的SVG标签(onload事件的最后一行“无法设置属性‘数据’空的” =” init(evt)“),我不完全确定为什么。思考?
哦,太棒了。谢谢你的提示。任何想法在哪里可以找到良好的svg脚本文档? – 2012-08-18 15:51:44
http://www.w3.org/Graphics/SVG/IG/resources/svgprimer.html是所有SVG的好开始 – 2012-08-18 16:48:12