2014-01-26 2 views
1

나는 attr을 통해 텍스트의 x, y 좌표를 변경할 수 있지만 tref를 통한 textcontent는 그렇지 않습니다. xlink : href가 작동하지 않습니다. 그것은 jsp 프레임에서 호출 되었기 때문입니다SVG tref -xlink : href가 작동하지 않습니다. x, y 좌표를 변경할 수 있지만 textcontent는 변경할 수 없습니다.

<?xml version="1.0" standalone="no"?> 
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics 
    /SVG/1.1  
    DTD/svg11.dtd"> 
    <html> 
    <head> 
    <script> 
    function ichange() { 
     var vx100=420; var vy100=100; 
     var res=vx100.valueOf(); var newv="budhan"; 
     document.getElementById("tts").setAttribute("x", res);//works 
     document.getElementById("tts").setAttribute("y", vy100);//works 
     tts.textContent="Mercury";//does not work 
     alert(tts.textContent); 
     } 
    </script> 
    </head> 
    <BODY> 
    <form> 
    <input id="button1" type="button" value="Change Dimensions" onclick="ichange();"/> 
    </form> 

    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org 
    /1999/xlink"  version="1.1" width="1100" height="800" > 
    <defs> 
    <text id="theText">Mercury</text> 
     </defs> 

     <text id="tts" x="50" y="80" font-size="17" fill="red">Sun </text> 
     <text id="tts" x="100" y="130" font-size="23" fill="black"><tref 
               xlink:href="#theText"/> </text> 
     <%--tref is not working .. basically need to replace string Sun with 
     String mercury--%> 
    </svg> 

    </body> 
    </html> 
+0

음 "사용"속성을 사용하여 작업하고 있습니다. – arun

답변

0

이 기능은 사양에서 제거되어 구현되지 않았습니다. (More infos)
use 요소는 좋은 대안입니다.

관련 문제