1. 程式人生 > >js_外部對象_location

js_外部對象_location

ava ctype reload load 百度 對象 cati inpu www.

<!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