location.replace()

書式

location.replace(URL)

説明

ページのURLを指定されたURLに置き換えます。

サンプルコード [実行]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<script type="text/javascript"><!--
function pageReplace () {
location.replace("http://www.openspc2.org/");
}
// --></script>
</head>
<body>
<form>
<input type="button" value="replace" onClick="pageReplace()">
</form>
</body>
</html>