By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,576 Members | 1,439 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,576 IT Pros & Developers. It's quick & easy.

Disabling copy/select on one image within a page

P: n/a
Hi, does anyone know how to apply onselectstart and ondragstart to just
one image on a page?

All of the posts I have found so far suggest adding these to the body
tag. The disadvantage of this is that it prevents users from selecting
anything at all on the page.

I need to isolate this to one particualr image. I've tried adding the
selectstarts to divs, the img tag etc but it doesn't seem to work.

I anyone knows how this works, I'd realy appreciate it as it's been
pecking my head for hours!!

Cheers
Dunk

Jul 21 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
While I know this is a little less elegant, perhaps you could show the
image as a background in a div instead of using the img tag:

<div style="background-image: url('myImage.gif'); background-repeat:
no-repeat;">

This may prevent the user from easily selecting the image.

dunk22 wrote:
Hi, does anyone know how to apply onselectstart and ondragstart to just
one image on a page?

All of the posts I have found so far suggest adding these to the body
tag. The disadvantage of this is that it prevents users from selecting
anything at all on the page.

I need to isolate this to one particualr image. I've tried adding the
selectstarts to divs, the img tag etc but it doesn't seem to work.

I anyone knows how this works, I'd realy appreciate it as it's been
pecking my head for hours!!

Cheers
Dunk
Jul 22 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.