본문 바로가기
JavaScript

35일차//JavaScript - 화면전환// history.back() : 이전 , location.reload(): 새로고침

by aesup 2021. 3. 3.
728x90

view.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>view1</title>
</head>
<body>


<!-- 화면전환 -->
<!-- 
	form action
	a href summit
	location. href
	

 -->

<h3>여기는 view1.html입니다</h3>
<a href = "view2.html">view2로 이동</a>


<script type="text/javascript">
	document.bgColor = '#F676C5';

</script>


</body>
</html>

view2.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body bgcolor="red">
<h2>여기는 view2.html입니다</h2>

<input type="button" value = "이전" onclick = "history.back()">

<input type="button" value = "현재 페이지를 갱신 = 새로고침" onclick = "location.reload()">

<input type="button" value = "진행" onclick = "history.forward()">

<button type="button" onclick = "gopage()">view3.html이동</button>


<script type="text/javascript">

function gopage(){
	
	location.href = "view3.html";
	
}


</script>


</body>
</html>

view3.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body bgcolor="yellow">
<h3>여기는 view3.html입니다</h3>

</body>
</html>
728x90