English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Proibição de seleção de texto ao mover o mouse em JavaScript

This is implemented by CSS style to disable the function of selecting with the mouse:

unselectable is ready for IE

onselectstart is ready for Chrome, Safari

-moz-user-select is FF's

css style:html,body{-moz-user-select: none; -khtml-user-select: none; user-select: none;}

or

<div unselectable="on" onselectstart="return false;" style="-moz-user-select:none;">

Style definition for shielded selection:-moz-user-select attribute (only supported by ff).

The attribute has three values:

1, none: Use none, all text of child elements cannot be selected, including the text in input boxes cannot be selected.

2, -moz-all: All text of child elements can be selected, but the text in input boxes cannot be selected.

3, -moz-none: All text of child elements cannot be selected, but the text in input boxes is an exception.

That's all for this article. I hope the content of this article can bring some help to everyone's learning or work, and I also hope to get more support for the Yell Tutorial!

Statement: The content of this article is from the Internet, the copyright belongs to the original author, the content is contributed and uploaded by Internet users spontaneously, this website does not own the copyright, does not edit manually, and does not assume any relevant legal liability. If you find any content suspected of copyright infringement, please send an email to: notice#oldtoolbag.com (when sending an email, please replace # with @ to report abuse, and provide relevant evidence. Once verified, this site will immediately delete the suspected infringing content.)

Você pode gostar