No Text Selection

This section contains a lot of Scripting material for your website.

No Text Selection

Postby MT Shahzad on March 15th, 2008, 12:21 pm

In order to disable the text selection on your web page, you can use the following javascript code:

Code: Select all
<script type="text/javascript">
<!--

   var omitformtags=["input", "textarea", "select"]

   omitformtags=omitformtags.join("|")

   function disableselect(e)
   {
      if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
         return false
   }

   function reEnable()
   {
      return true
   }

   if (typeof document.onselectstart!="undefined")
      document.onselectstart=new Function ("return false")
   
   else
   {
      document.onmousedown=disableselect
      document.onmouseup=reEnable
   }

-->
</script>
MT Shahzad
Web/Software Developer
http://mts.sw3solutions.com
User avatar
MT Shahzad
Site Admin
 
Posts: 300
Joined: February 29th, 2008, 8:11 am
Location: Muridke, Pakistan

Return to Java Script / VB Script

Who is online

Users browsing this forum: No registered users and 0 guests

cron