출처

페이지 이동 : javascript (자바스크립트)

location.href="URI";

자동으로 특정페이지로 이동할 때 사용

location.href="notice/List.jsp";

a 태그 이용

<script type="text/javascript">
  function goPage() {
    location.href = "notice/List.jsp";
  }
</script>

<a href="javascript:goPage()">공지사항 목록</a> <br />

이벤트 사용 (get 방식)

<button onclick="goPage()">공지사항 목록</button>
<div onmouseover="goPage()" style="background-color: yellow; width: 100px; color: black; ">공지사항 목록</div>

이벤트 사용 (post 방식)

<script type="text/javascript">
  function gopagePost() {
    //0클라이언트 부분에서의 에러검증 코드 자리
    document.myForm.action = "/myShop/notice/List.jsp";
    document.myForm.method = "post";
    document.myForm.submit();
  }
</script>
<form name="myForm"> <input type="hidden" name="abc" value="차카다" /> <input type="button" onclick="gopagePost()"
    value="공지사항목록" />
</form>

location.replace(URL);

지정한 URL로 이동

<script type="text/javascript">
  function goReplace(str) {
    location.replace(str);
  }
</script>
<button onclick="goReplace('/myShop/notice/List.jsp')">공지사항 목록</button>

location.reload();

페이지 새로고침

<script type="text/javascript">
  function goReload() {
    location.reload();
  }
</script>
<button onclick="goReload()">페이지 재호출</button>

history.go(값); :

지정한 페이지로 이동 (값은 숫자임 (예)-1, 2)

<script type="text/javascript">
  function historyGo(i) {
    history.go(i);
  }
</script>
<button onclick="historyGo(-3)">historyGo</button>`