JavaScript ? ??
Location ??
JavaScript ?? ??? ?? URL ??? ????? ???? ? ?????. Location ??? window ??? ???? window.location ??? ?? ???? ? ????.
Location ??? URL ??? ??? ??? ?? ???? ?? ???? ??? ???? ?? ???? ? ?? ?????. ??? ??? ?? ??? ?? ? ???? ?????.
?? ?? ??
?? ??????????????????????????????????????????????????????????> ?? URL ?? ?? ????(??? ???? ?? ????) location.pathname URL?? ?? ?? ?? ????
location.port URL ???? ?? ?? ?? ????
Location ?? ???
History ???? ??? ?? 3?? ???? ????. : ? ??? ?? ?? location.reload(): ?? ??? ?? ??(?? ??) location.replace(): ?? ??? ? ??? ??JavaScript location.href ?? Location ??? href ??? ?? ?? URL? ????? ???? ? ?????. ??? ??? ????.
location.href = URL
location.href ??? ????? ?? ????? ?????. JavaScript? ??(????)
(?? ????) ?? URL ??: JavaScript location.pathname ?? Location ??? pathname ??? ?? URL? ?? ??? ????? ???? ? ?????. ??? ??? ????. location.pathname = path ?? URL? ?? ??? ?????. JavaScript location.sign() ??? Location ??? ??() ???? ? ??? ???? ? ?????. ??? ??? ????. ??.??(URL) <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</title>
<script type="text/javascript">
document.write(location.href);
</script>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</title>
<script type="text/javascript">
document.write(location.pathname);
</script>
</head>
<body>
</body>
</html>
? ?? ??: <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</title>
<script type="text/javascript">
function setAssign(){
window.location.assign("http://ipnx.cn");
}
</script>
</head>
<body>
<button onclick="setAssign()">加載新文檔</button>
</body>
</html>