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.
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">
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!