アンカー リンクを検出する条件を作成できましたが、その後、使用を特定の URL にリダイレクトできるように、アンカー リンクを anchor_num 変数に格納するにはどうすればよいですか?
<script type="text/javascript">
$(function(){
if(window.location.hash){
var anchor_num = "anchorString";
window.location = "#"+ anchor_num;
} else
{
//redirect to default page
}
});
</script>