This way, when I move the mouse, there is no function to trigger the OnMouseMove event binding. It's awkward to operate. Later I tidied up a bit. A total of three ways to solve this problem: It's not clear which way is better. When you have the ability to judge the pros and cons.
1, Document.images[i].ondragstart=function () {return false;};
Directly loop all the IMG tags on the page. The ondragstart event will then return FALSE, which disables the default drag action of the browser image. Feel here to traverse all IMG Tags: Individuals do not like to use this method. Feel that performance is not the best. Subjective think only.
2, Event.preventdefault ();
In Handler.onmousedown = function (event) {}, add Event.preventdefault ();
This method notifies the Web browser not to perform the default action associated with the event (if such an action exists). For example, if the type attribute is "submit", any event handle can be called at any stage of event propagation, and by calling the method, you can prevent the form from being submitted. Note that if the Cancelable property of the Event object is Fasle, there is no default action, or the default action cannot be blocked. In either case, calling the method has no effect.
3, This.setcapture && this.setcapture ();
In Handler.onmousedown = function (event) {} Add this.setcapture && this.setcapture ();
The SetCapture function sets the mouse capture in the specified window that belongs to the current thread. Once the window captures the mouse, all mouse input is directed at the window, regardless of whether the cursor is within the bounds of the window. Only one window can capture the mouse at a time. Individuals like this approach. Feel more reliable.
Other than that.. If you use a third method. Mouse capture is set at onmousedown, and when OnMouseUp is added, a release mouse is captured: Handle.releasecapture && handle.releasecapture () Or else it's going to go wrong under IE6. # Although in other modern browsers no problem #
About handling Forbidden pictures default drag behavior action