Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 24th, 2008, 03:39 PM
Authorized User
Join Date: Mar 2008
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default question reg ondragstart event

Hello everyone,

Can I disable dragging and highliting the text or images (ie hold down the mouse key and drag over text/images with turns them to blue) using the ondragstart event?

I tried this -><body ondragstart="return false">
but doesnt seem to have any effect.Any other way?

Thanks in advance!

Old August 23rd, 2008, 04:00 PM
richard.york's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts

You want onselectstart for IE and Safari, probably Opera too.

Mozilla uses CSS to control this in Firefox...

body {
    -moz-user-select: none;

The drag and drop API is for dragging and dropping items, not selection. Only IE and Safari supports that API anyway.

Author, Various Wrox Books

Similar Threads
Thread Thread Starter Forum Replies Last Post
Event Bubbling Question Aaron Edwards ASP.NET 2.0 Professional 1 January 22nd, 2007 03:05 AM
Event Bubbling Question Aaron Edwards ASP.NET 2.0 Basics 0 January 17th, 2007 01:47 PM
Another window.event.srcelement question Ron Howerton Visual Basic 2005 Basics 0 January 16th, 2007 05:09 PM
FormView Event Question melbsurfer ASP.NET 2.0 Basics 1 May 10th, 2006 12:46 PM
Mouse Event Question muklee Javascript How-To 1 June 9th, 2005 07:44 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.