javascript – 取得網址的hash,也就是#後方的文字

 

<script>
//取得網址的hash,例如取得http://XXX.tw/#type
var hash = window.location.hash.substring(1);
alert(hash); //輸出type
</script>

發表迴響