By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,712 Members | 2,111 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,712 IT Pros & Developers. It's quick & easy.

onDrop event not working correctly

P: n/a
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
--
Newsguy -- http://newsguy.com

Sep 28 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Don't rely on MS only characteristics.

They are here today. They are gone tommorrow.

---------------------------------------


<ri**@newsguy.com> wrote in message news:dh********@drn.newsguy.com...
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
--
Newsguy -- http://newsguy.com


Sep 29 '05 #2

P: n/a
In article <sk********************@tornado.tampabay.rr.com> , commercial says...

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


---------------------------------------


<ri**@newsguy.com> wrote in message news:dh********@drn.newsguy.com...
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
--
Newsguy -- http://newsguy.com


Sep 29 '05 #3

P: n/a
commercial said the following on 9/29/2005 4:11 AM:
Don't rely on MS only characteristics.
Half true.
They are here today. They are gone tommorrow.


Totally false.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Sep 29 '05 #4

P: n/a
ri**@newsguy.com wrote:
In article <sk********************@tornado.tampabay.rr.com> , commercial says...
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.


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:
<URL:http://www.w3.org/TR/DOM-Level-3-Events/events.html>

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>

[...]
--
Rob
Sep 30 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.