Home>Article>Web Front-end> How to disable selection in html
htmlMethods to set prohibited selection: 1. By adding relevant attributes in the body tag, the code is [7f32b020fbdcf372ad484818004949ab]; 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:
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!