Why won't this work right 
Author Message
 Why won't this work right

The object of this is to make the IMG dragable when I press the control Key.
The problem is,  I have to press the CTRL Key and then move the mouse over
the IMG, I want to have the mouse in the image and then press the CTRL Key
to make it dragable.  The other problem is that after you move an IMG if you
go to move another as soon as you press the CTRL Key and move the mouse the
last IMG you just moved appears where the mousse is.  Thanks for any help,
If you would like to see the page it is located at www.bethpage.net/desktop
This isn't going to be a web page but an active desktop, when I'm finished.

Tim Campbell

<script language="VBScript">
 Public thisObject, dragOK, xOffset, yOffset
 dragOK = False

   Sub document_onmouseover()
      If window.event.ctrlKey = True Then
            If window.event.srcElement.tagName="IMG" Then
                Set thisObject = window.event.srcElement
                dragOK = True
                xOffset = window.event.offsetX
                yOffset = window.event.offsetY
            thisObject.style.zindex = 0
         End If
      End If
   End Sub

   Sub document_onmousemove()
      If window.event.ctrlKey = True And dragOK Then
        newLeft = window.event.x - xOffset
        newTop = window.event.y - yOffset
        thisObject.style.left = newLeft
        thisObject.style.top = newTop
        window.event.returnValue = False
        window.event.cancelBubble = True
      End If
   End Sub

   Sub document_onmouseup()
        dragOK = False 'resets the dragablity to False
   End Sub
</script>



Wed, 18 Apr 2001 03:00:00 GMT  
 Why won't this work right
If you just change your onmouseover to onmousedown, it seems to work
correctly (the dragOK gets properly set & reset).

--
Mickey


The object of this is to make the IMG dragable when I press the control Key.
The problem is,  I have to press the CTRL Key and then move the mouse over
the IMG, I want to have the mouse in the image and then press the CTRL Key
to make it dragable.  The other problem is that after you move an IMG if you
go to move another as soon as you press the CTRL Key and move the mouse the
last IMG you just moved appears where the mousse is.  Thanks for any help,
If you would like to see the page it is located at www.bethpage.net/desktop
This isn't going to be a web page but an active desktop, when I'm finished.

Tim Campbell

<script language="VBScript">
Public thisObject, dragOK, xOffset, yOffset
dragOK = False

   Sub document_onmouseover()
      If window.event.ctrlKey = True Then
            If window.event.srcElement.tagName="IMG" Then
                Set thisObject = window.event.srcElement
                dragOK = True
                xOffset = window.event.offsetX
                yOffset = window.event.offsetY
            thisObject.style.zindex = 0
         End If
      End If
   End Sub

   Sub document_onmousemove()
      If window.event.ctrlKey = True And dragOK Then
        newLeft = window.event.x - xOffset
        newTop = window.event.y - yOffset
        thisObject.style.left = newLeft
        thisObject.style.top = newTop
        window.event.returnValue = False
        window.event.cancelBubble = True
      End If
   End Sub

   Sub document_onmouseup()
        dragOK = False 'resets the dragablity to False
   End Sub
</script>



Thu, 19 Apr 2001 03:00:00 GMT  
 Why won't this work right
Okay, didn't realize you were using images as hyperlinks. This way still
should work, though, as long as you release Ctrl then move your cursor off
the image before releasing the mouse button.

--
Mickey



Thu, 19 Apr 2001 03:00:00 GMT  
 Why won't this work right
Thanks for the help but that really was not what I was looking.  When it is
finished it is going to put on all our network computers, ofcouse with
different links, but it will be the back ground for everyone, so I need to
make it as idiot proof  and simple as possible.  If you have any other ideas
let me know.  Thanks again.

Tim Campbell



Thu, 19 Apr 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Why won't this work right

2. Two Q's [Closing a file][why won't work]

3. Why won't this work with NS6?

4. Why won't this work?

5. Why won't this work?

6. why won't this work?

7. Why in tarnation won't it work

8. Q:Why won't this sort work?

9. Why won't this Ping Vbcript work..

10. Newbie - Why won't this work?

11. Why won't this work?

12. why won't this work?

 

 
Powered by phpBB® Forum Software