How can I disable drag and drop?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #16
    Just a couple of notes:
    1. The script language attribute is deprecated, so use type instead:
    Code:
    <script type="text/javascript">
    2. Unless you want to display a message, return false as hsriat pointed out is better:
    [code=html]<div id="myDiv" onmousedown="re turn false;">[/CODE]

    Comment

    • solnyc
      New Member
      • Oct 2008
      • 2

      #17
      Originally posted by mclerp
      Thank you for your help. I haven't been able to get this to work but that's probably because I don't know how to write the full code. As a Newbie, I am VERY new and haven't written any Java script before. However, the routine described by RamananKaliraja n works well. Thanks to everyone who has replied to my question ..... mclerp
      Hi RamananKaliraja n,

      I tried using that code you wrote for the "image disable". You'd had said there is a way to get around the text issue so folks can type in input boxes while not being able to drag images.

      Can you explain how to do this?

      Thanks in advance

      Comment

      • rnd me
        Recognized Expert Contributor
        • Jun 2007
        • 427

        #18
        two tricks that work even if javascript is disabled:

        1. change the images to relative positioned divs, height and width specified. then set the background-image to the .src of the img tag the div replaces.

        2. place a relative positioned, background-color: transparent, height and width specified, border: 0px text input in front of the image. this clear input intercepts clicks even without javascript, giving you the crappy input-related menu options like paste, select All, and copy.

        Comment

        • solnyc
          New Member
          • Oct 2008
          • 2

          #19
          It seems that there is no multi-browser script that keeps users from downloading/dragging images to their computer desktop.

          or is there?

          Comment

          Working...