How to disable selection in html

coldplay.xixi
Release: 2023-01-05 16:12:18
Original
6013 people have browsed it

htmlMethods to set prohibited selection: 1. By adding relevant attributes in the body tag, the code is [<body "return false;" onselectstart="return false">]; 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:

<body "return false;" onselectstart="return false">
Copy after login

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;};
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template