location.href = "위치"
<button type="button" onclick="location.href = '다른 html 파일'">버튼속안의말</button>
클릭하여 검색하는 경우도 있지만 엔터를 통해 검색하는 경우도 있기 때문에 두가지 모두 설정하기
document.querySelector("버튼위치").onclick = () => {
...
}
document.querySelector("입력위치").onkeydown = (e) => {
if(e.keyCode == 13){ // 엔터를 입력하면
...
}
}
키보드 및 운영체제의 차이가 존재하고, 국가별 레이아웃이 다른 등 여러 이유때문에 keycode는 다를 수 있다.
Windows => PrintScreen 일반적으로 44
macOS => Command + Shift + 3
Command : 91, Shift : 16, 3 : 51
const encodeVal = encodeURI(inputText); // 컴퓨터 언어
// inputText 는 입력한 값에 대한 변수명
const decodeVal = decodeURI(encodeVal); // 사람 언어