diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/svgaelement | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/svgaelement')
-rw-r--r-- | files/zh-cn/web/api/svgaelement/index.html | 165 |
1 files changed, 165 insertions, 0 deletions
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 +--- +<div>{{APIRef("SVG")}}</div> + +<h2 id="SVG_a_DOM_接口">SVG a DOM 接口</h2> + +<p><code>SVGAElement</code>接口提供了对{{ SVGElement("a") }}元素的属性的访问,而且还提供了操作该元素的方法。</p> + +<h3 id="接口概览">接口概览</h3> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="row">又作用于</th> + <td>{{ domxref("SVGElement") }}、 {{ domxref("SVGURIReference") }}、 {{ domxref("SVGTests") }}、 {{ domxref("SVGLangSpace") }}、 {{ domxref("SVGExternalResourcesRequired") }}、 {{ domxref("SVGStylable") }}、 {{ domxref("SVGTransformable") }}</td> + </tr> + <tr> + <th scope="row">方法</th> + <td><em>无</em></td> + </tr> + <tr> + <th scope="row">属性</th> + <td> + <ul> + <li>只读属性 {{ domxref("SVGAnimatedString") }} <code>target</code></li> + </ul> + </td> + </tr> + <tr> + <th scope="row">规范文档</th> + <td><a class="external" href="http://www.w3.org/TR/SVG11/linking.html#InterfaceSVGAElement" title="http://www.w3.org/TR/SVG11/linking.html#InterfaceSVGAElement">SVG 1.1 (2nd Edition)</a></td> + </tr> + </tbody> +</table> + +<h2 id="属性">属性</h2> + +<p>这个接口同样会从父级元素 <em>{{domxref("SVGGraphicsElement")}}</em>继承属性,并实现 <em>{{domxref("SVGURIReference")}}</em> 和 <em>{{domxref("HTMLHyperlinkElementUtils")}}</em> 中的功能。</p> + +<p><strong>{{domxref("SVGAElement.download")}} </strong></p> + +<p> 参见 {{domxref("HTMLAnchorElement.download")}}</p> + +<p><strong>{{domxref("SVGAElement.href")}} </strong></p> + +<p> See {{domxref("HTMLAnchorElement.href")}}</p> + +<p><strong>{{domxref("SVGAElement.hreflang")}} </strong></p> + +<p> 是一个反映 <code>hreflang</code> 属性的字符串( DOMString ),表示链接资源的语言种类。</p> + +<p><strong>{{domxref("SVGAElement.ping")}} </strong></p> + +<p> 是一个反映ping值的字符串( DOMString ),包含以空格分隔开的URL列表,当超链接可以被跟踪时,浏览器会(在后台)发送有PING主体的 {{HTTPMethod("POST")}} 的请求,一般用于追踪。</p> + +<p><strong>{{domxref("SVGAElement.referrerPolicy")}} </strong></p> + +<p> 参见 {{domxref("HTMLAnchorElement.referrerPolicy")}}</p> + +<p><strong>{{domxref("SVGAElement.rel")}} </strong></p> + +<p><strong> </strong>参见 {{domxref("HTMLAnchorElement.rel")}}</p> + +<p><strong>{{domxref("SVGAElement.relList")}} </strong></p> + +<p> 参见{{domxref("HTMLAnchorElement.relList")}}</p> + +<p><strong>{{domxref("SVGAElement.target")}} {{readonlyInline}} </strong></p> + +<p><strong> </strong> 它和特定元素的 {{SVGAttr("target")}} 属性相同</p> + +<p><strong>{{domxref("SVGAElement.text")}} </strong></p> + +<p> 是一个字符串( DOMString ),作为 {{domxref("Node.textContent")}} 属性的代名词。</p> + +<p><strong>{{domxref("SVGAElement.type")}} </strong></p> + +<p> 是一个反映 <code>type</code> 属性的字符串( DOMString ),表示链接资源的MIME种类。</p> + +<h2 id="方法">方法</h2> + +<p><code><font face="Open Sans, Arial, sans-serif">该</font>SVGAElement接口没有提供任何专有的方法。</code></p> + +<h2 id="示例">示例</h2> + +<p>在下面的这个例子里, {{SVGElement("a")}} 元素的 {{SVGAttr("target")}} 属性值是 <code>_blank</code> ,当链接被点击时,它将记录以通知是否符合条件。</p> + +<pre class="brush: js"><code class="language-js"><span class="keyword token">var</span> linkRef <span class="operator token">=</span> document<span class="punctuation token">.</span><span class="function token">querySelector</span><span class="punctuation token">(</span><span class="string token">"a"</span><span class="punctuation token">)</span><span class="punctuation token">;</span> +linkRef<span class="punctuation token">.</span>target <span class="operator token">=</span> <span class="string token">"_self"</span><span class="punctuation token">;</span> </code> + +linkRef<span class="punctuation token">.</span><span class="function function-variable token">onclick</span> <span class="operator token">=</span> <span class="keyword token">function</span><span class="punctuation token">(</span><span class="punctuation token">)</span><span class="punctuation token">{</span> + <span class="keyword token">if</span> <span class="punctuation token">(</span>linkRef<span class="punctuation token">.</span>target <span class="operator token">===</span> <span class="string token">"_blank"</span><span class="punctuation token">)</span> <span class="punctuation token">{</span> + console<span class="punctuation token">.</span><span class="function token">log</span><span class="punctuation token">(</span><span class="string token">"BLANK!"</span><span class="punctuation token">)</span><span class="punctuation token">;</span> + linkRef<span class="punctuation token">.</span>target <span class="operator token">=</span> <span class="string token">"_self"</span><span class="punctuation token">;</span> + <span class="punctuation token">}</span> <span class="keyword token">else</span> <span class="punctuation token">{</span> + console<span class="punctuation token">.</span><span class="function token">log</span><span class="punctuation token">(</span><span class="string token">"SORRY! not _blank"</span><span class="punctuation token">)</span><span class="punctuation token">;</span> + <span class="punctuation token">}</span> +<span class="punctuation token">}</span></pre> + +<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2> + +<p>{{ CompatibilityTable() }}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{ CompatVersionUnknown() }}</td> + <td>{{ CompatVersionUnknown() }}</td> + <td>9.0</td> + <td>{{ CompatVersionUnknown() }}</td> + <td>{{ CompatVersionUnknown() }}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{ CompatUnknown() }}</td> + <td>{{ CompatVersionUnknown() }}</td> + <td>{{ CompatUnknown() }}</td> + <td>{{ CompatVersionUnknown() }}</td> + <td>{{ CompatVersionUnknown() }}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="参见">参见</h2> + +<ul> + <li>{{ SVGElement("a") }} SVG Element</li> +</ul> |