執行 ❯
建立您
自己的
網站
×
更改方向
儲存程式碼
更改主題,暗/亮
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>The Window Location Object</h1> <h2>The port Property</h2> <p id="demo"></p> <p><b>Note: </b>If the port number is default (80 for http and 443 for https), most browsers return nothing.</p> <script> let port = location.port; document.getElementById("demo").innerHTML = "The port number of the current page is: " + port; </script> </body> </html>