hash
ページ上のアンカー情報を参照/設定します。
構文
document.リンクオブジェクト.hash
例文
<html> <head> <title>hash</title> <script type="text/javascript"><!-- window.onload = function () { var n = document.links[0].hash; document.getElementById("result").innerHTML = n; } // --></script> </head> <body> <ul> <li><a href="#1">#1</a> <li><a href="#2">#2</a> </ul> <div id="result"></div> </body> </html>
関連記事
スポンサーリンク