tags:

views:

44

answers:

1

I am pretty sure i seen sites that make firefox (and other browsers?) select text only within a div and not span across other divs. How do i do that

A: 

Based on this.

<html>
    <head>
        <title>No Select!</title>
        <script>
            window.onload = function() {
                document.onselectstart = function() {return false;} // ie
                document.onmousedown = function() {return false;} // mozilla
            }
        </script>
    </head>
    <body>
        Select me!
    </body>
</html>

By the way try to avoid this kind of stuff as it's not cool to prevent visitors from their basic rights!! If someone wants to select a text, they'll know how to do it and there's no way to prevent it.

Hamid Nazari
maybe the title confused you. i revised it
acidzombie24
you mean when the user presses Ctrl+A?
Hamid Nazari