以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 SVG/GML/VRML/X3D/XAML 』  (http://bbs.xml.org.cn/list.asp?boardid=21)
----  在svg如何动态加载图片  (http://bbs.xml.org.cn/dispbbs.asp?boardid=21&rootid=&id=40536)


--  作者:xiaoerwen
--  发布时间:11/27/2006 11:42:00 AM

--  在svg如何动态加载图片
我想在svg中动态加载图片,代码如下,但图片好象显示不出来,为什么?
<svg  version="1.1" baseProfile="full"
xmlns:a="http://www.adobe.com/svg10-extensions"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:ev="http://www.w3.org/2001/xml-events"
id="FlowSvg">

 <g id="BKBackground" fill="#708090" stroke="lightgrey" stroke-width="1"  shape-rendering="optimizeSpeed">
   
 <rect x="10" y="10" width="100" height="500" id="BKToolRect"  onmousedown='Init(evt)'/>
  
 </g>
<script language="javascript" id="svgJS">
<![CDATA[
function Init(evt)
{
 BKToolRect = document.getElementById("BKToolRect");
 SVGDocument = evt.target.ownerDocument;
 SVGRoot = SVGDocument.documentElement;
 var shape = document.createElement("image");
 shape.setAttribute("id", "flow");
 //alert('flow'+iIndex);
 shape.setAttribute("x", 200);
 shape.setAttribute("y", 200);
 shape.setAttribute("width", 40);
 shape.setAttribute("height", 40);
 var xlinkns = "http://www.w3.org/1999/xlink";
 shape.setAttributeNS(xlinkns,'xlink:href','image/FlowN2.gif');
 shape.setAttribute("canmove", "true");
 shape.setAttribute("oldX", 200);
 shape.setAttribute("oldY", 200);
 shape.setAttribute("type", 'flow');
 shape.setAttribute("before", "none");
 shape.setAttribute("beyond", 'none');
 SVGRoot.appendChild(shape);
}
]]>
</script>
</svg>


--  作者:xiaoerwen
--  发布时间:11/27/2006 11:48:00 AM

--  
我用svg view 3.0能看到,但用firefox不行
--  作者:alai7150
--  发布时间:1/6/2007 10:28:00 AM

--  
遇到同样的问题
我的svgviewer是adobe1.1
我动态插入图片看不到,其实已经插入进去了,就是没有显示出来,
应该是svgviewer的问题
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
46.875ms