浏览器禁止选择

浏览器禁止选中

模拟滚动条时可以用

<!DOCTYPE html>

<html>

<head>

    <meta charset=“UTF-8" />

    <title></title>

</head>

<style type="text/css">

.chromeOnselectstart{-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-o-user-select:none;user-select:none;}

</style>

<body>

试试能选中我不    <br />

试试能选中我不    <br />

试试能选中我不    <br />

试试能选中我不    <br />

试试能选中我不    <br />

试试能选中我不    <br />

试试能选中我不    <br />

试试能选中我不    <br />

试试能选中我不    <br />

试试能选中我不    <br />

试试能选中我不    <br />

试试能选中我不    <br />

试试能选中我不    <br />

试试能选中我不    <br />

试试能选中我不    <br />

试试能选中我不    <br />

试试能选中我不    <br />

试试能选中我不    <br />

</body>

<script type="text/javascript">

if (document.all) {

        //ie 

        document.body.onselectstart = new Function("return false");

    } else {

        document.body.className = "chromeOnselectstart";

    }

</script>

</html>

 

你可能感兴趣的:(浏览器)