HTML DOM port 屬性
定義和用法
port 屬性是一個可讀可寫的字符串,可設(shè)置或返回當前 URL 的端口部分。
語法
location.port=portnumber
實例
假設(shè)當前的 URL 是: http://example.com:1234/test.htm#part2:
<html> <body> <script type="text/javascript"> document.write(location.port); </script> </body> </html>
輸出:
1234