location객체
js 페이지 이동
location.href=주소;
js 새로고침
location.reload()
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<button onclick="move()">네이버 이동하기</button>
<script>
//3초마다 새로고침
// setInterval(function(){
// location.reload();
// },3000)
function move(){
location.href="https://www.naver.com";
}
</script>
</body>
</html>
'JS' 카테고리의 다른 글
230105 JS navigator객체 (0) | 2023.01.05 |
---|---|
230105 JS history객체 (0) | 2023.01.05 |
230104 JS window객체와 애니메이션 실습 (0) | 2023.01.04 |
230104 JS window객체-타임아웃 (0) | 2023.01.04 |
230104 JS window객체- 인터벌 (0) | 2023.01.04 |