以前作一個網上答題的頁面時,考慮到要防止考生利用複製粘貼來提升做弊的可能性,就設計了不容許複製。
方法也很簡單,經過設置CSS 的 user-select就能夠達到目的:html
-moz-user-select:none; /* Firefox私有屬性 */ -webkit-user-select:none; /* WebKit內核私有屬性 */ -ms-user-select:none; /* IE私有屬性(IE10及之後) */ -khtml-user-select:none; /* KHTML內核私有屬性 */ -o-user-select:none; /* Opera私有屬性 */ user-select:none; /* CSS3屬性 */
user-select的默認值是 text:能夠選擇文本
none:文本不被選擇web