我有一个svgpage,code片段如下:<g id="testSet">
<animation id="test0" display="none" begin="indefinite" x="0" y="0" width="1280" height="720" xlink:href="testPages/page1.svg">page1 Test</animation>
                <animation id="test1" display="none" begin="indefinite" x="0" y="0" width="1280" height="720" xlink:href="testPages/page2.svg">page2 Test</animation>
</g>还有一个对应的js文件处理这个svg,在onload的时候有如下操作:var thisTest = document.getElementById('test0');
thisTest.setAttributeNS(svgNS, "display", "inline");
thisTest.beginElement();然后我就看到"testPages/page1.svg"的内容被show出来了,但是不清楚这是怎样一个工作方式?是像location一样重定向到"testPages/page1.svg" url上了?还是单单这是将"testPages/page1.svg"页面里的内容提了出来?
实在查不到thisTest.setAttributeNS(svgNS, "display", "inline");
thisTest.beginElement();这两句话的具体含义,还望高手指点

解决方案 »

  1.   

    http://www.w3school.com.cn/xmldom/met_element_setattributens.asp
    setAttributeNS() 方法创建或改变具有命名空间的属性。
    语法:
    elementNode.setAttributeNS(name,value)参数 描述 
    ns 必需。规定要设置的属性的命名空间 URI。 
    name 必需。规定要设置的属性的名称。 
    value 必需。规定要设置的属性的值。例子 1
    下面的代码向 "books_ns.xml" 中的第一个 <book> 元素添加一个 "edition" 属性:xmlDoc=loadXMLDoc("books_ns.xml");x=xmlDoc.getElementsByTagName("book")[0];
    ns="http://www.w3school.com.cn/edition/";x.setAttributeNS(ns,"edition","first");document.write(x.getAttributeNS(ns,"edition")); 这个是setAttributeNS的解释
    下面的beginElement()就不知道了,没见过这个函数。
      

  2.   

    这个是svg的动画相关的函数,表示启动动画标签animation 所指向的动画。