Created
June 24, 2011 09:24
-
-
Save jinwei233/1044491 to your computer and use it in GitHub Desktop.
取消文字选中
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>demo</title> | |
<meta charset='utf-8'/> | |
<style type="text/css" media="screen"> | |
</style> | |
</head> | |
<body> | |
<div id="test"> | |
你试一下能选中我不?!选中啊,有木有 | |
</div> | |
<script type="text/javascript"> | |
function clearSelction(){ | |
window.getSelection ? window.getSelection().removeAllRanges():document.selection.empty(); | |
} | |
setTimeout(function(){ | |
clearSelction(); | |
setTimeout(arguments.callee,500) | |
},500) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment