js 페이지 이동 방법: 1. "location.href="URL""을 사용합니다. 2. "location.replace("URL")"를 사용합니다. 3. "location.sign("URL")"을 사용합니다. "window.open("URL")"을 사용하세요.

이 튜토리얼의 운영 환경: Windows 7 시스템, JavaScript 버전 1.8.5, Dell G3 컴퓨터.
페이지 이동을 구현하는 Javascript 방법:
1. 다른 웹 페이지로 이동하려면 location.href 속성을 사용하세요.
구문:
location.href="URL";
예:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<p>这是<i>location.href</i>方式的示例</p>
<button onclick="myFunc()">点击这里</button>
<!--重定向到其他网页的脚本-->
<script>
function myFunc() {
window.location.href="//m.sbmmt.com";
}
</script>
</body>
</html>2. () 메서드를 사용하여 다른 웹 페이지로 이동
구문:
location.replace("URL");예:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<p>这是<i>location.replace()</i>方式的示例</p>
<button onclick="myFunc()">点击这里</button>
<!--重定向到其他网页的脚本-->
<script>
function myFunc() {
location.replace("//m.sbmmt.com");
}
</script>
</body>
</html>[권장 학습: javascript 고급 튜토리얼]
3 다른 웹으로 이동하려면 location.sign() 메서드를 사용하세요. 페이지
문법:
location.assign("URL")예:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<p>这是<i>location.assign()</i>方式的示例</p>
<button onclick="myFunc()">点击这里</button>
<!--重定向到其他网页的脚本-->
<script>
function myFunc() {
location.assign("//m.sbmmt.com");
}
</script>
</body>
</html>4. window.open() 메서드를 사용하여 다른 웹 페이지로 이동합니다.
문법:
window.open("URL");예:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<p>这是<i>window.open()</i>方式的示例</p>
<button onclick="myFunc()">点击这里</button>
<!--重定向到其他网页的脚本-->
<script>
function myFunc() {
window.open("//m.sbmmt.com");
}
</script>
</body>
</html>더 많은 프로그래밍 관련 지식을 보려면, 방문해주세요: 프로그래밍 비디오 ! !
위 내용은 자바스크립트에서 페이지 점프를 구현하는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!