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/location/tostring/index.html | |
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/location/tostring/index.html')
-rw-r--r-- | files/zh-cn/web/api/location/tostring/index.html | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/location/tostring/index.html b/files/zh-cn/web/api/location/tostring/index.html new file mode 100644 index 0000000000..84a5fdddff --- /dev/null +++ b/files/zh-cn/web/api/location/tostring/index.html @@ -0,0 +1,42 @@ +--- +title: 'Location: toString()' +slug: Web/API/Location/toString +translation_of: Web/API/Location/toString +--- +<p><font><font>{{ApiRef(“ Location”)}}</font></font></p> + +<p><strong><code>toString()</code></strong><font><font>{{domxref(“ Location”)}}接口</font><font>的</font><font>stringifier方法返回包含整个URL的{{domxref(“ USVString”)}}}。</font><font>它是{{domxref(“ Location.href”)}}的只读版本。</font></font></p> + +<h2 id="句法"><font><font>句法</font></font></h2> + +<pre class="syntaxbox notranslate"><em>string</em> = <em>object</em>.toString();</pre> + +<h2 id="例子"><font><font>例子</font></font></h2> + +<pre class="brush: js notranslate">// Let's imagine an <a id="myAnchor" href="https://developer.mozilla.org/en-US/docs/Location/toString"> element is in the document +var anchor = document.getElementById("myAnchor"); +var result = anchor.toString(); // Returns: 'https://developer.mozilla.org/en-US/docs/Location/toString' +</pre> + +<h2 id="技术指标"><font><font>技术指标</font></font></h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col"><font><font>规范</font></font></th> + <th scope="col"><font><font>状态</font></font></th> + <th scope="col"><font><font>评论</font></font></th> + </tr> + <tr> + <td><font><font>{{SpecName('HTML WHATWG',“#dom-location-href”)}}</font></font></td> + <td><font><font>{{Spec2('HTML WHATWG')}}</font></font></td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性"><font><font>浏览器兼容性</font></font></h2> + +<div class="hidden"><font><font>此页面上的兼容性表是根据结构化数据生成的。</font><font>如果您想贡献数据,请查看</font></font><a href="https://github.com/mdn/browser-compat-data"><font><font>https://github.com/mdn/browser-compat-data</font></font></a><font><font>并向我们发送请求请求。</font></font></div> + +<p><font><font>{{Compat(“ api.Location.toString”)}}</font></font></p> |