/    Sign up×
Community /Pin to ProfileBookmark

Make items unselectable?

I’m trying to make a game with javascript where you shoot things by clicking the mouse, but every time you click twice fast, many of the images get highlighted on the page. Is there any way to make objects unselectable?It is kinda ruining the game.

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceMar 12.2006 — onfocus="this.blur(); return false;"

Caveat: I haven't tested whether this will prevent any other events from firing.
Copy linkTweet thisAlerts:
@dirtygerman55authorMar 12.2006 — That doesn't work with highlighting.
Copy linkTweet thisAlerts:
@phpnoviceMar 12.2006 — OK, how about this?

ondblclick="this.blur(); return false;"
Copy linkTweet thisAlerts:
@dirtygerman55authorMar 12.2006 — It blurs the entire page, but it doesn't unhighlite the images. It just blurs the window.
Copy linkTweet thisAlerts:
@phpnoviceMar 12.2006 — One more time:

onselect="return false;"
×

Success!

Help @dirtygerman55 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...