From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/svgaelement/index.html | 165 +++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 files/zh-cn/web/api/svgaelement/index.html (limited to 'files/zh-cn/web/api/svgaelement') diff --git a/files/zh-cn/web/api/svgaelement/index.html b/files/zh-cn/web/api/svgaelement/index.html new file mode 100644 index 0000000000..67b523dd70 --- /dev/null +++ b/files/zh-cn/web/api/svgaelement/index.html @@ -0,0 +1,165 @@ +--- +title: SVGAElement +slug: Web/API/SVGAElement +tags: + - API + - SVG + - SVG DOM + - WebAPI + - 参考 + - 需要兼容性表 + - 需要示例 +translation_of: Web/API/SVGAElement +--- +
{{APIRef("SVG")}}
+ +

SVG a DOM 接口

+ +

SVGAElement接口提供了对{{ SVGElement("a") }}元素的属性的访问,而且还提供了操作该元素的方法。

+ +

接口概览

+ + + + + + + + + + + + + + + + + + + + +
又作用于{{ domxref("SVGElement") }}、 {{ domxref("SVGURIReference") }}、 {{ domxref("SVGTests") }}、 {{ domxref("SVGLangSpace") }}、 {{ domxref("SVGExternalResourcesRequired") }}、 {{ domxref("SVGStylable") }}、 {{ domxref("SVGTransformable") }}
方法
属性 +
    +
  • 只读属性 {{ domxref("SVGAnimatedString") }} target
  • +
+
规范文档SVG 1.1 (2nd Edition)
+ +

属性

+ +

这个接口同样会从父级元素 {{domxref("SVGGraphicsElement")}}继承属性,并实现 {{domxref("SVGURIReference")}}{{domxref("HTMLHyperlinkElementUtils")}} 中的功能。

+ +

{{domxref("SVGAElement.download")}}

+ +

    参见 {{domxref("HTMLAnchorElement.download")}}

+ +

{{domxref("SVGAElement.href")}}

+ +

    See {{domxref("HTMLAnchorElement.href")}}

+ +

{{domxref("SVGAElement.hreflang")}}

+ +

    是一个反映 hreflang 属性的字符串( DOMString ),表示链接资源的语言种类。

+ +

{{domxref("SVGAElement.ping")}}

+ +

    是一个反映ping值的字符串( DOMString ),包含以空格分隔开的URL列表,当超链接可以被跟踪时,浏览器会(在后台)发送有PING主体的 {{HTTPMethod("POST")}} 的请求,一般用于追踪。

+ +

{{domxref("SVGAElement.referrerPolicy")}}

+ +

    参见 {{domxref("HTMLAnchorElement.referrerPolicy")}}

+ +

{{domxref("SVGAElement.rel")}}

+ +

    参见 {{domxref("HTMLAnchorElement.rel")}}

+ +

{{domxref("SVGAElement.relList")}}

+ +

    参见{{domxref("HTMLAnchorElement.relList")}}

+ +

{{domxref("SVGAElement.target")}} {{readonlyInline}}

+ +

    它和特定元素的 {{SVGAttr("target")}} 属性相同

+ +

{{domxref("SVGAElement.text")}}

+ +

    是一个字符串( DOMString ),作为 {{domxref("Node.textContent")}} 属性的代名词。

+ +

{{domxref("SVGAElement.type")}}

+ +

    是一个反映 type 属性的字符串( DOMString ),表示链接资源的MIME种类。

+ +

方法

+ +

SVGAElement接口没有提供任何专有的方法。

+ +

示例

+ +

在下面的这个例子里, {{SVGElement("a")}} 元素的 {{SVGAttr("target")}} 属性值是 _blank ,当链接被点击时,它将记录以通知是否符合条件。

+ +
var linkRef = document.querySelector("a");
+linkRef.target = "_self"; 
+
+linkRef.onclick = function(){
+  if (linkRef.target === "_blank") {
+    console.log("BLANK!");
+    linkRef.target = "_self";
+  } else {
+    console.log("SORRY! not _blank");
+  }
+}
+ +

浏览器兼容性

+ +

{{ CompatibilityTable() }}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}9.0{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}
+
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{ CompatUnknown() }}{{ CompatVersionUnknown() }}{{ CompatUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}
+
+ +

参见

+ + -- cgit v1.2.3-54-g00ecf