]; 2. Add relevant statements in js."/> ]; 2. Add relevant statements in js.">

Home>Article>Web Front-end> How to disable selection in html

How to disable selection in html

coldplay.xixi
coldplay.xixi Original
2021-04-28 11:31:08 5954browse

htmlMethods to set prohibited selection: 1. By adding relevant attributes in the body tag, the code is [7f32b020fbdcf372ad484818004949ab]; 2. In js Add relevant statements.

How to disable selection in html

The operating environment of this tutorial: windows7 system, html5 version, DELL G3 computer.

htmlHow to set prohibited selection:

1. By adding the following attributes to the body tag:


      

The previous sentence prohibits right-clicking. The following sentence prohibits copying.

2. Add the following two lines of statements in js:

//禁止页面选择以及鼠标右键 document.function(){return false;}; document.onselectstart=function(){return false;};

Related learning recommendations:html video tutorial

The above is the detailed content of How to disable selection in html. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to save html file Next article:How to save html file