「JavaScript」location.hrefのサンプル
書式
top.location.href="xxx"
parent.location.href="xxx"
location.href-“xxx"
使用例1
<body onload="parent.top.location.href='xxx'">
<body onload="parent.top.location.href='xxx'">
<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()">
<script>
function funcA(){
if (confirm("別ページに移動しますか?")==true)
location.href = "xxx";
}
</script>
<input type="button" name="link" value="テスト" onclick="funcA()">
<script> function funcA(){ if (confirm("別ページに移動しますか?")==true) location.href = "xxx"; } </script> <input type="button" name="link" value="テスト" onclick="funcA()">