<!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
原文地址:http://www.cnblogs.com/Bighua123/p/7634368.html