js_外部对象_location

Posted dahua7758521

tags:

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

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>location地址栏</title>
<script type="text/javascript">
function f1() {
var b=confirm("你确定离开本页面么???")

if(b){
//跳转
location.href="http://www.baidu.com";
}
}
function f2() {
//刷新
location.reload();
}
</script>
</head>
<body>
<input type="button" value="百度"
onclick="f1();">
<input type="button" value="刷新"
onclick="f2();">
</body>
</html>



























以上是关于js_外部对象_location的主要内容,如果未能解决你的问题,请参考以下文章