IT Study/Web

[JavaScript] location 관련 함수 - back(), reload(), forward()

도뿌리 2018. 8. 6. 14:37
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body bgcolor="#ff0000">
 
<h2>index2.html입니다.</h2>
 
<form>
    <input type="button" value="이전" onclick="history.back()">    <!-- 이전페이지로 -->
    
    <input type="button" value="갱신" onclick="location.reload()"<!-- 페이지 갱신 -->
    
    <input type="button" value="진행" onclick="history.forward()"<!-- 페이지 뒤로가기했을때  다시 앞 페이지로 넘어감 -->
    
    <input type="button" value="Top페이지로" onclick="location.href='index1.html'">
    
</form>
 
<a href="index3.html">index3.html로 이동</a>
 
</body>
</html>
cs


back() -> explorer의 뒤로가기와 같다.

reload() - > explorer의 새로고침과 같다.

forward() -> explorer의 앞으로가기와 같다.