www.webdeveloper.com
Results 1 to 2 of 2

Thread: no text select

  1. #1
    Join Date
    May 2004
    Posts
    4

    no text select

    using a script i found a dynamicdrive.com, i was able to make it so that you couldn't select text on a webpage:

    <script language="JavaScript1.2">
    function disableselect(e){
    return false
    }
    function reEnable(){
    return true
    }
    document.onselectstart=new Function ("return false")
    if (window.sidebar){
    document.onmousedown=disableselect
    document.onclick=reEnable
    }
    </script>
    does anybody know how to adjust this script so that you still cannot select text, but inside of a input field you may?

    thanks alot!!

    -randy

  2. #2
    Join Date
    Nov 2003
    Location
    Worthington, OH, USA
    Posts
    3,634
    Actually it only keeps you from selecting with the mouse, and if I turn off JS it doesn't even do that. But if you insist:
    PHP Code:
    <input type="text" onfocus="document.onmousedown=''" onblur="document.onmousedown=disableselect"/> 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles