File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Drag and Drop event handlers for Firefox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Drag and Drop event handlers for Firefox" Watch "Drag and Drop event handlers for Firefox" New topic

Drag and Drop event handlers for Firefox

Abhishek Asthana
Ranch Hand

Joined: Sep 08, 2004
Posts: 146

I need to implement drag and drop across frames and I tried using the latest Drag And Drop event handlers (in Firefox 3):
ondrag, ondragstart, ondragenter, ondragover etc. but nothing works.

My code is simple one:

This code should give an alert when one tries to drag the image. But absolutely nothing happens!

The example given on also doesn't seem to work. (The image never gets dragged anywhere!)

On this page: the documentation says that ondragstart "is the HTML 5 spec name for the event and may be used in HTML or XUL handlers will work for both HTML and XUL."

The documentation says: "There are two ways that drag and drop events can be handled. This first involves using the drag and drop XPCOM interfaces directly. The second is to use a JavaScript wrapper object that handles some of this for you."

I am very confused with this. Can someone please tell me how to do drag and drop using these event handlers?

Any pointers/examples will help.

It is sorta covered in the JavaRanch Style Guide.
subject: Drag and Drop event handlers for Firefox