onDrop event not working correctly

R

rich

Hi,

Been trying to work through a simple drag and drop interface using either IMG,
SPAN or DIV tags. That way I can define blocks of text and/or graphics as
draggable and be able to drop them on a similar (img, div, span, etc.) target,
preferably an image.

I can highlight text from an "<input type=text>" field and reach a target to
trigger an event (e.g. alert();), but can't get the same response when the
dragged item is a block of text or an graphic and drop it on either of the same
targets.

Example Page: http://web.newsguy.com/fp2000/testdnd.html

The Microsoft site mentioned that the onDrop event has some default
characteristics that limit the dragged object to an input field, but other tags
can be used if the "ondragover="window.event.returnValue=false" and
ondragenter="window.event.returnValue=false" settings are added to get around
the defaults. Not sure if I'm overlooking the obvious or if I misunderstood
this. Any tips or alternate recommendations appreciated.

Thanks in advance,

Rich
 
R

rich

Don't rely on MS only characteristics.

They are here today. They are gone tommorrow.


Actually tested the code across a number of browsers. I can setup drag and drop
so a selected item moves around a web page on different web browsers (e.g. FF,
Safari, IE). If the non-MS browsers are able to drag an item around a web page
just as IE does, it would seem useless to have that available unless javascript
had the "onDrop" functionality to trigger something when the drag is done.

Maybe I'm taking the wrong approach to this. Anyone heard of a way to simulate
drag and drop, maybe with a combination of onMouse... events, that can be used
as an alternative. Certainly wouldn't want to limit its usefulness to IE.

Thanks,
Rich
--
Newsguy -- http://newsguy.com

 
R

RobG

Actually tested the code across a number of browsers. I can setup drag and drop
so a selected item moves around a web page on different web browsers (e.g. FF,
Safari, IE). If the non-MS browsers are able to drag an item around a web page
just as IE does, it would seem useless to have that available unless javascript
had the "onDrop" functionality to trigger something when the drag is done.

I think you mean that the DOM should have a 'drop' event. But anyway,
it doesn't. I guess ondrop has been implemented by some browser vendors
in order to provide that functionality, but non-standards stuff is
generally more inconsistent than standards-based stuff (innerHTML
springs to mind).

DOM 2 events:
<URL:http://www.w3.org/TR/DOM-Level-2-Events/events.html>

DOM 3 events:
Maybe I'm taking the wrong approach to this. Anyone heard of a way to simulate
drag and drop, maybe with a combination of onMouse... events, that can be used
as an alternative. Certainly wouldn't want to limit its usefulness to IE.

Yes, using a combination of other events. There is some stuff at the
link below that may be useful:

<URL:http://www.walterzorn.com/dragdrop/dragdrop_e.htm>

[...]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top