<text/>

1、测试代码:

 1 <!DOCTYPE html >
 2 
 3 <html>
 4 
 5 <style type="text/css">
 6 <!--
 7 
 8 -->
 9 </style>
10 
11 <script type="text/javascript" >
12 <!--
13 
14 
15     window.onload = function()
16         {
17             var idText01 = document.getElementById("idText01");
18             console.log(idText01);
19             console.log(idText01.innerText);
20             console.log(idText01.innerHTML);
21             console.log(idText01.textContent);
22             console.log("* * *");
23         /*    for (zz in idText01)
24             {
25                 console.log(zz);
26             }
27             //*/
28         };
29 
30 -->
31 </script>
32 
33 
34 <svg width="1000" height="800" viewBox="0 0 1000 800" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:cge="http://iec.ch/TC57/2005/SVG-schema#" xmlns:hzsvg="http://holleygrid.cn/svg">
35 
36 
37     <text id="idText01" font-size="30" font-family="SimSun" stroke="rgb(98, 190, 157)" stroke-width="0.106666666666667" x="0.6288" y="30.9472" >PD</text>
38     
39 </svg>
40 
41 </html>

 

2、

2.1、IE9 里面,SVGTextElement 没有 innerText 和 innerHTML 属性,用的是 textContent

2.2、chrome(版本 49.0.2623.87 m) 里面,有 innerHTML 和 textContent,没有 innerText

 

3、

看来,得用 属性textContent 更加好一点

 

4、

 

5、

 

posted @ 2016-04-05 14:25  Html5Skill  阅读(408)  评论(0编辑  收藏  举报