반응형
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
//브라우저 내장객체
//window - location
// - history
// - document - images, link,...
// - form - text,password,textarea
// - checkbox, radio
// - select - option
// history 방문기록 주제
// (length 방문기록 개수 저장하는 멤버변수)
// (back() 방문기록 중에 이전페이지 이동 멤버함수
// forward() 방문기록 중에 다음페이지 이동 멤버함수)
// go(-1) 1단계 이전페이지 이동 go(1) 1단계 다음페이지 이동
// history.length history.back() history.forward()
function fun1() {
// 방문기록개수
alert(history.length);
}
function fun2() {
// 한칸뒤로이동
// test9.html -> test8.html -> test9.html
history.back();
}
function fun3() {
// 한칸앞으로이동
// test9.html -> test8.html -> 뒤로이동
history.forward();
}
</script>
</head>
<body>
<h1>js1/test9.html</h1>
<input type="button" value="방문기록개수" onclick="fun1()">
<input type="button" value="한칸뒤로이동" onclick="fun2()">
<input type="button" value="한칸앞으로이동" onclick="fun3()">
<form action="test9_1.html" method="get">
아이디 : <input type="text" name="id"><br>
비밀번호 : <input type="password" name="pass"><br>
<input type="submit" value="로그인">
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
alert("뒤로이동");
history.back();
// location.href="test9.html";
</script>
</head>
<body>
<h1>js1/test9_1.html</h1>
</body>
</html>
반응형
'JavaScript' 카테고리의 다른 글
[JavaScript] 폼 속성 form(text,password,textarea) (0) | 2021.11.11 |
---|---|
[JavaScript] 브라우저 내장객체(document) (0) | 2021.11.09 |
[JavaScript] 브라우저 내장객체(Location Object) (0) | 2021.11.07 |
[JavaScript] Window confirm() Method (0) | 2021.11.07 |
[JavaScript] 연산결과 리턴하기(Operators) (0) | 2021.11.07 |