「JavaScript」location.hrefのサンプル

書式
top.location.href="xxx"
parent.location.href="xxx"
location.href-“xxx"
使用例1

<body onload="parent.top.location.href='xxx'">

使用例2

<script>
function funcA(){
  if (confirm("別ページに移動しますか?")==true)
    location.href = "xxx";
}
</script>
<input type="button" name="link" value="テスト" onclick="funcA()">

 

JavaScript

Posted by arkgame