🚀 from error to study/Server
[태그 사용법] 태그를 사용하여 링크 이동하는 법
천재강쥐
2022. 11. 2. 14:29
1. <a> 태그
<a href="<%= contextPath %>/유알엘매핑값"></a>
2. <button 태그>
1. 버튼 onclick 속성으로 직접 링크 걸기
<button onclick="location.href='<%= contextPath %>/유알엘매핑값"></button>
2. 버튼 onclick 속성으로 function 호출 후 해당 function에 링크 걸기 (보안성 향상)
<button onclick="changePage();"></button>
<script>
function changePage() {
location.href="<%= contextPath %>/유알엘매핑값";
}
</script>