이 기사에서는 JS가 다양한 브라우저와 호환되는 고급 드래그 방법에 대해 설명합니다. 다음과 같이 참조에 대해 공유하십시오.
<! docType html public "-// w3c // dtd html 4.01 // en" "http://www.w3.org/tr/html4/strict.dtd"> <html> <head> <meta http-equiv = "content-type"content = "text/html; witf/html; 드래그 </title> <tyle> #tobedRaged {너비 : 100px; 높이 : 100px; 라인 높이 : 100px; 테두리 : 1px 솔리드 레드; 위치 : 절대; 텍스트 정렬 : 센터; Font-Family : Arial, Helvetica, Sans-Serif; 커서 : 이동; } </style> <script type = "text/javaScript"> window.onload = function () {dodrag (); } function dodrag () {var div = document.getElementById ( "tobedRaged"); var posx; var posy; div.onmousedown = function (e) {var e = e || Window.event; if (div.setCapture) {div.setCapture (); } posx = e.clientx -parseint (div.offsetleft); posy = e.clienty -parseint (div.offsettop); document.onmouseMove = function (ev) {var ev = ev || window.event; // if if (ev.setcapture) {} div.style.left = (ev.clientx -posx)+"px"; div.style.top = (ev.clienty -posy)+"px"; } document.onmouseup = function () {document.onmouseMove = null; document.onmouseup = null; if (div.releasecapture) {div.releasecapture (); }}}}}} </script> </head> <body> <div id = "tobedRaged"> 당신은 나를 드래그! </div> </body> </html>JavaScript 관련 컨텐츠에 대한 자세한 내용은이 사이트의 주제를 확인하십시오. "JavaScript 스위칭 효과 및 기술 요약", "JavaScript 검색 알고리즘 기술 요약", "JavaScript 애니메이션 효과 및 기술 요약", "Javascript 오류 및 디버깅 기술의 요약" "JavaScript 기술의 요약" "" "요약" "", Malgority Sknickes의 요약 "". JavaScript Traversal 알고리즘 및 기술 "및"JavaScript 수학 연산 사용 요약 "
이 기사가 모든 사람의 JavaScript 프로그래밍에 도움이되기를 바랍니다.