Location replace() 方法

Posted ylht

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Location replace() 方法相关的知识,希望对你有一定的参考价值。

replace() 方法可用一个新文档取代当前文档。

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>test</title>
<script>
function replaceDoc(){
    window.location.replace("http://www.baidu.com")
}
</script>
</head>
<body>

<input type="button" value="载入新文档替换当前页面" onclick="replaceDoc()">

</body>
</html>

 

以上是关于Location replace() 方法的主要内容,如果未能解决你的问题,请参考以下文章