location.port

ポート番号を返します。ただし、80番ポートの場合は何も返しません。

構文

location.port

例文

<html>
 <head>
  <title>location.port</title>
  <script type="text/javascript"><!--
  window.onload = function () {
   document.getElementById("result").innerHTML = location.port;
  }
  // --></script>
 </head>
 <body>
 <div id="result"></div>
 </body>
</html>

関連記事

スポンサーリンク

appendChild

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る