代码示例:(标识:eg_js_location_assign)
<!DOCTYPE html>
<html>
<body>

<h1>window.location 对象</h1>

<input type="button" value="加载新的文档" onclick="newDoc()">

<script>
function newDoc() {
  window.location.assign("http://www.sou-xun.com")
}
</script>

</body>
</html>
运行结果: