运行 ❯
获取你
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h2>JavaScript</h2> <h3>The window.location object</h3> <p id="demo"></p> <p><b>Note: </b>If the port number is default (80 for http and 443 for https), most browsers will display 0 or nothing.</p> <script> document.getElementById("demo").innerHTML = "The URL port number of the current page is: " + window.location.port; </script> </body> </html>