473,382 Members | 1,392 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Javascript handle drag and drop

I wrote a piece of code to handle drag and drop of DIV element.
The code works fine in firefox, but has some problem will IE. We I load the
HTML, I can not drag the DIV, and IE seems to be not responding to anything.
But when I minimize the IE window, and maximize it again, the code works
fine.
Can anybody give me some case that can cause this situation?
Oct 28 '06 #1
6 2460
"Kai Zhu" <cs***@hotmail.comwrote in message
news:eh**********@news.yaako.com...
>I wrote a piece of code to handle drag and drop of DIV element.
The code works fine in firefox, but has some problem will IE. We I load
the HTML, I can not drag the DIV, and IE seems to be not responding to
anything. But when I minimize the IE window, and maximize it again, the
code works fine.
Can anybody give me some case that can cause this situation?
What version of IE?

--
Smerf
"Why don't pet food companies make mouse flavored cat food?"
Oct 28 '06 #2

Kai Zhu wrote:
I wrote a piece of code to handle drag and drop of DIV element.
The code works fine in firefox, but has some problem will IE. We I load the
HTML, I can not drag the DIV, and IE seems to be not responding to anything.
But when I minimize the IE window, and maximize it again, the code works
fine.
Can anybody give me some case that can cause this situation?
You may want to show what your code looks like, for the DnD.

Also, if you can't figure out how to get it to work, you can look at
various libraries that will do DnD.

I am curious if when the user clicks on the div, if you then set the
mousemove event handler so that you can track where the mouse is at.

You should also set the mouseup at that point on the div, so that when
they release the mouse you can unset these two events, and stop the
dragging.

Here is a simple tutorial that may help you out:
http://www.webreference.com/programm...mn2/index.html

Oct 28 '06 #3

Kai Zhu wrote:
I wrote a piece of code to handle drag and drop of DIV element.
The code works fine in firefox, but has some problem will IE. We I load the
HTML, I can not drag the DIV, and IE seems to be not responding to anything.
But when I minimize the IE window, and maximize it again, the code works
fine.
Can anybody give me some case that can cause this situation?
See the source code of http://www.cwdjr.net/test/newDrag.html . This
works on all browser that I have, including IE6, and it will drag
divisions, images, or text. The script is based on one posted in this
group 2 or 3 years ago by Lasse Nielsen as noted in a comment in the
source code. This question often comes up here. There are a lot of drag
codes out there that work only on a few browsers.

Oct 28 '06 #4
Kai Zhu wrote:
I wrote a piece of code to handle drag and drop of DIV element.
You're wasting your time.

Use http://developer.yahoo.com/yui/
Oct 29 '06 #5

TheBagbournes wrote:
Kai Zhu wrote:
I wrote a piece of code to handle drag and drop of DIV element.

You're wasting your time.

Use http://developer.yahoo.com/yui/
Thus site may work. However I can not recommend it. For example, in
their simple example of code to drag 3 objects, a very simple case,
they managed to generate over 200 lines of code on the main page with
links to 6 external scripts, and there were several validation errors
at the W3C validator. They seem to have generated a bloated
one-size-fits-all code, that reminds me of some of the Windows programs
for writing code. Also, for the several external scripts, you are
linking to an outside server rather than to your own if you are not
using Yahoo as a host. Of course you likely could download this whole
bloated mess of Yahoo scripts, but you will then have to put them all
up on your server and link to several external scripts every time you
wish to use even the most simple drag-and-drop operation.

Oct 29 '06 #6
Thank you for recommending this nice code to me, this helps a lot.
"cwdjrxyz" <sp*******@cwdjr.infowrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
>
Kai Zhu wrote:
>I wrote a piece of code to handle drag and drop of DIV element.
The code works fine in firefox, but has some problem will IE. We I load
the
HTML, I can not drag the DIV, and IE seems to be not responding to
anything.
But when I minimize the IE window, and maximize it again, the code works
fine.
Can anybody give me some case that can cause this situation?

See the source code of http://www.cwdjr.net/test/newDrag.html . This
works on all browser that I have, including IE6, and it will drag
divisions, images, or text. The script is based on one posted in this
group 2 or 3 years ago by Lasse Nielsen as noted in a comment in the
source code. This question often comes up here. There are a lot of drag
codes out there that work only on a few browsers.

Oct 29 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: David McCulloch | last post by:
Although I am able to drag and drop HTML links, I am no longer able to drag Javascript links. In the past, I have been able to drag a link from such places as the TinyURL! link on...
2
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put...
3
by: Ajay Krishnan Thampi | last post by:
I have a slight problem implementing 'drag and drop' from a datagrid to a tree-view. I have pasted my code below. Someone please advice me on what to do...pretty blur right now. ==code== ...
1
by: Dragon | last post by:
Is there any examples of Drag and Drop how to handle in C# ?
8
by: ericgorr | last post by:
I have the following test page: http://ericgorr.net/test.html <html> <head><title>Simple JavaScript</title></head> <BODY ondragstart="alert(event.srcElement.tagName)"> <INPUT TYPE=text...
3
by: crazystone82 | last post by:
Hi friends, i need to drag a file from desktop and drop into web page.actually i had did a JS for dragging the images around the web page,but i dont know how to drag the file and drop it into...
12
by: lorlarz | last post by:
Unobtrusive JavaScript leads to BUILDERS (e.g. drag drop activity builder) Once you totally remove JS from a web page, and learn the shortcuts and efficiencies provided by a library like...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.