473,387 Members | 1,687 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,387 software developers and data experts.

Drag-and-drop - object not moving with the mouse on IE7

17
I have this code creating an object to drag-and-drop:

Expand|Select|Wrap|Line Numbers
  1. window.onload = function()
  2. {
  3.     var dragObject = document.createElement('DIV');
  4.     dragObject.id = 'dragObject';
  5.     dragObject.style.cssText = 'position:absolute;display:none;';
  6.     document.body.appendChild(dragObject);
  7. }
Then, onmousedown:

Expand|Select|Wrap|Line Numbers
  1. function dragme(obj)
  2. {
  3.     var dragObject = document.getElementById("dragObject");
  4.     while (dragObject.hasChildNodes())
  5.     {
  6.         dragObject.removeChild(get_lastchild(dragObject));
  7.     }    
  8.  
  9.     dragObject.appendChild(obj.cloneNode(true));
  10.     dragObject.style.display = 'block';
  11.     dragObject.style.visibility = 'visible';
  12.     dragObject.firstChild.style.display = 'block';
  13.     dragObject.firstChild.style.visibility = 'visible';
  14. }
And these functions to update the object's coordinates:

Expand|Select|Wrap|Line Numbers
  1. function mouseMove(ev)
  2. {
  3.     ev= ev || window.event;
  4.  
  5.        var dragObject = document.getElementById("dragObject");
  6.         if(dragObject.hasChildNodes()){
  7.         dragObject.style.position = 'absolute';
  8.         dragObject.style.left = mouseCoords(ev).x;
  9.         dragObject.style.top = mouseCoords(ev).y;
  10.     }
  11. }
  12.  
  13. function mouseCoords(ev)
  14. {
  15.     if(ev.pageX || ev.pageY){
  16.         return {x:ev.pageX, y:ev.pageY};
  17.     }
  18.     return {
  19.         x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
  20.         y:ev.clientY + document.body.scrollTop  - document.body.clientTop
  21.     };
  22. }

But still, in IE7, I don't get to see the object moving with the mouse when I try to drag an <tr> element - it is hidden somewhere.

Please, advise...
Oct 1 '07 #1
1 1669
scf1984
17
p.s. - It wroks great on FireFox, but not on IE7 :(
Oct 1 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: John Guarnieri | last post by:
Hi All, I need some code to drag items in a list box either up or down along with not just the text but with the itemdata too. Can anyone hook me up? TIA John
11
by: kiran | last post by:
I am trying to implement a rubber band/image selection script. For that I need to remove the default drag behaviour on an image. I am able to do this in IE but not Netscape. Does any one have a...
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...
0
by: Raja Gopal | last post by:
Hi , I am able to drag controls on to the canvas only when I am in grid layout but not when I am in flow layout . Please suggest me a solution. Thanks, Raja Gopal
1
by: jos | last post by:
Hi , I have a vb.net form without a Title Bar. How do i program such that i can still drag the window anywhere on my desktop?? Thanks Jots
2
by: CB | last post by:
Is it possible to drag the browser itself from inside the document window? What I want to do is open a browser window without a title bar, but be able to drag it around the screen as if I was...
0
by: joycsharp | last post by:
in my app, a listview control have many pic ,so i want to drag the pic to my desktop ,but i don't what i do. thanks .
2
by: prasadrmarathe | last post by:
Hi, I have created one custom buton server control which will shown on it the nuber of time it was clicked as its text. I have added the custom control in my another projects tool box but i...
0
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
Being you can drag webparts from zone to zone, is there a way to control drag speed while dragging/scrolling up the page? I have a list of webparts that may go beyond the page. If a user wants...
1
Ali Rizwan
by: Ali Rizwan | last post by:
Hi all, I want to drag my form which has no title bar but has a label. I want to drag my form by the help of that label. Thanx
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.