Skip to content

Instantly share code, notes, and snippets.

@WesternRanger
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WesternRanger/3e7bdfd4383863aae1f9 to your computer and use it in GitHub Desktop.
Save WesternRanger/3e7bdfd4383863aae1f9 to your computer and use it in GitHub Desktop.

#保证文本不被选中的方式 之前写的东西鼠标在网页上点,一些文字总是可恶的被选中,很烦人,后来才知道,加入一段脚本可以防止被选中。现在归纳一下。 ###方式一:

登录通行
最简洁,onselectstart=“return false;”内嵌式。 ###方式二: document.onselectstart = new Function('event.returnValue=false;'); 在脚本文件第一行写上这个函数即可。

可能还有好多中方式,我知道这两种方式,其他的还要留心学习。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment