html - disable text drag and drop -


is a common feature of modern browsers where a user can select some text and drag it into the input field in the same area Within this it leads to the text, imitates between different areas, how do I disable it? If there is no portable way, then I'm more interested in Firefox. It is an intranet webpage, so I'm also interested in modifying the browser / getting the plugin for it. Maybe some system-level settings (on Windows XP)?

I need to keep the default selection-copy-paste functionality.

In the background, I have many field data entry forms and users often mistakenly drag something.

This code will work in all versions of Mozilla and IE

  function preventDrag (event) {if (event.type == 'dragenter' || event.type == 'dragover' || // If drag on event - Allows drop event To capture, it is not allowed to drag on the target event by default. Type == 'drop') // Stop text dragging - IE and new Mozilla (like Firefox 3.5+) {if (event. StopPropagation) // (Mozilla) {event.preventDefault (); Event.stopPropagation (); // To prevent the drag operation of bubbling up / off, and to modify the text on old Mozilla (except for Firefox 3.5, which does not have a drop event - this prevents the capture of old dragon events)) return false; // (IE)}} page after the page listener has loaded the window.onload = function () {var myTextInput = document.getElementById ('textInput'); // Target any dom element here if (myTextInput.addEventListener) // (Mozilla) {myTextInput.addEventListener ('dragenter', handle alent, true); // MyTextInput.addEventListener for the drop event ('Drawer', Handling Eldants, Truth); // MyTextInput.addEventListener for drop event ('Drop', Pause, Drag, True); } And if (myTextInput.attachEvent) // (IE) {myTextInput.attachEvent ('ondragenter', stop cash); MyTextInput.attachEvent ('ondragover', prevention drag); MyTextInput.attachEvent ('ondrop', Prevention Drug); }}  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -