aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/url/port/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/api/url/port/index.html')
-rw-r--r--files/zh-cn/web/api/url/port/index.html57
1 files changed, 57 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/url/port/index.html b/files/zh-cn/web/api/url/port/index.html
new file mode 100644
index 0000000000..5a50e2daf1
--- /dev/null
+++ b/files/zh-cn/web/api/url/port/index.html
@@ -0,0 +1,57 @@
+---
+title: URL.port
+slug: Web/API/URL/port
+translation_of: Web/API/URL/port
+---
+<div>{{ApiRef("URL API")}}</div>
+
+<div>{{domxref("URL")}} 接口的端口属性是包含了URL的端口号信息的{{domxref("USVString")}}值,如果URL中不包含明确的端口号,这个属性将为<code>''</code>.</div>
+
+<div></div>
+
+<p>{{AvailableInWorkers}}</p>
+
+<h2 id="语法"><strong>语法</strong></h2>
+
+<pre class="syntaxbox"><em>string</em> = <em>object</em>.port;
+<em>object</em>.port = <em>string</em>;
+</pre>
+
+<h3 id="参数">参数</h3>
+
+<p>A {{domxref("USVString")}}.</p>
+
+<h2 id="示例">示例</h2>
+
+<pre class="brush: js">var url = new URL('<span class="message-body-wrapper"><span class="message-flex-body"><span class="devtools-monospace message-body"><span class="cm-string">https://mydomain.com:80/svn/Repos/</span></span></span></span>');
+var result = url.port; // Returns:'80'
+</pre>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">备注</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('URL', '#dom-url-port', 'URL.port')}}</td>
+ <td>{{Spec2('URL')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+
+
+<p>{{Compat("api.URL.port")}}</p>
+
+<h2 id="相关链接">相关链接</h2>
+
+<ul>
+ <li>The {{domxref("URL")}} interface it belongs to.</li>
+</ul>