В этой статье описывается метод JS для достижения эффекта выбора мыши. Поделитесь этим для вашей ссылки, следующим образом:
<! Doctype html public "-// w3c // dtd html 4.01 // en" "http://www.w3.org/tr/html4/strict.dtd"> * html> htmlet http-equiv =" content-type "=" text/html; Эффект выбора коробки </title> <style> *{Padding: 0; поля: 0; } #bottom {position: Absolute; Внизу: 0px; Ширина: 100%; Высота: 40px; Граница: 1PX SOLID #000; Фон:#000; Цвет: #fff; } .tempdiv {border: 1px пунктирный синий; Фон:#5A72F8; позиция: абсолютно; Ширина: 0; высота: 0; Фильтр: альфа (непрозрачность: 10); непрозрачность: 0.1} </style> <script type = "text/javascript"> window.onload = function () {var atationbar = document.getelementbyid ("внизу"); document.onmousedown = function (e) {var posx = e.clientx; var posy = e.clienty; var div = document.createElement ("div"); div.classname = "tempdiv"; div.style.left = e.clientx+"px"; div.style.top = e.clienty+"px"; document.body.appendchild (div); document.onmousemove = function (ev) {div.style.left = math.min (ev.clientx, posx) + "px"; div.style.top = math.min (ev.clienty, posy) + "px"; div.style.width = math.abs (posx - ev.clientx)+"px"; div.style.height = math.abs (posy - ev.clienty)+"px"; statebar.innerhtml = "mousex:" + ev.clientx + "<br/> Mousey:" + ev.clienty; document.onmouseup = function () {div.parentnode.removechild (div); document.onmouseMove = null; document.onmouseup = null; }}}} </script> </head> <body> <div id = "bottom"> </div> </body> </html>For more information about JavaScript related content, please check out the topics of this site: "Summary of JavaScript switching effects and techniques", "Summary of JavaScript search algorithm skills", "Summary of JavaScript animation effects and techniques", "Summary of JavaScript errors and debugging techniques", "Summary of JavaScript data structures and algorithm skills", "Summary of Алгоритмы и методы обхода JavaScript »и« Сводка использования математических операций JavaScript ».
Я надеюсь, что эта статья будет полезна для каждого программирования JavaScript.