반응형 전체 글147 crtl 키와 command 키 막기 crtl키와 command 키를 막는 방법에 대해 알아보도록 하겠습니다. 저는 페이지를 저장하는 것을 막기 위해 crtl키와 command 키를 막았습니다. crtl 키와 command 키는 새로고침을 하기 위해서만 사용하기 위해 crtl키와 command 키는 r키와만 함께 눌리게 만들었고 r키가 아닐 경우에는 금지하게 만들었습니다. 참고 부탁드립니다. document.addEventListener('keydown', function(e) { if (e.metaKey || e.ctrlKey) { if (e.key !== 'r') e.preventDefault(); }})'keydown' 이벤트 발생 시에 function 함수가 실행이 됩니다. e.metaKey는 command 키.. 2024. 11. 25. 텍스트 변경해 가며 쓰기 원하는 텍스트들을 번갈아가며 화면에 썼다가 지웠다 하는 방법을 알아보도록 하겠습니다. 소스 코드 먼저 살펴보도록 하겠습니다. (function() { const spanEl = document.querySelector("main h2 span"); const txtArr = ['는 산업자동화', '는 레벨센서', '는 유량계', '는 압력계', '는 온도계', '는 최고입니다.']; let index = 0; let currentTxt = txtArr[index].split(""); function writeTxt() { spanEl.textContent += currentTxt.shift(); if(currentTxt.length !== 0) .. 2024. 11. 18. 자동 검색 및 pagination! input 태그를 사용하여 자동 검색을 만들어 보도록 하겠습니다. 우선 소스 코드입니다. javascript입니다. const userCardContainer = document.querySelector("[data-user-cards-container]");const userCardTemplate = document.querySelector("[data-user-template]");const headerSearchInput = document.getElementById("headerSearch");const portfolioSearchInput = document.getElementById("productSearch");let company = "A";let dataSet = "./informati.. 2024. 11. 11. html 요소 클릭시 문자열 복사하기 이번에는 특정 요소를 클릭 시에 crtl + C 복사하는 방법을 알아보도록 하겠습니다. 코드부터 살펴보도록 하겠습니다.html입니다. 02-4848-4848 javascript입니다. function copy(text){ window.getSelection().removeAllRanges(); try { navigator.clipboard.writeText(text); } catch {} window.getSelection().removeAllRanges();} onclick 속성은 클릭 시 실행되는 명령어입니다. title 속성은 마우스를 가져다 놓고 기다리다 보면 나오는 문자열입니다. window.getSelection().removeAllRan.. 2024. 11. 4. 이전 1 2 3 4 ··· 37 다음 반응형