FREE tutorial,solution,RSS Feeds on Operating Systems, Programming, Web Development, Applications, Databases, Networking, Hardware, Security, SEO Free Expertsforge Membership
Join us as Moderator
Submit Article to Expertsforge.com Submit Article My Expertsforge
 
RSS Feeds, Help Help RSS Feeds
bannertop
 

JavaScript Tutorial: Disabling Shift and Ctrl keys using javascript

jawahar
1/31/2007 5:51:00 PM, Views: 2093
The following code shows how to disable the shift and ctrl keys in the keyboard. You can use this event to prevent new window being opened while pressing shift/ctrl keys and clicking a link.

<html>
<head>
<script language="Javascript" type="text/javascript">
function disablekeys(event)
{
   if (event.shiftKey==1 or event.crtlKey==1 )
      {
      return false
      }
   }
</script>
</head>
<body>
<a href="sample.html" onclick="return disablekeys(event)">Press Shift or ctrl and click me</a>
</body>
</html>
Next Steps:
Add this Tutorial to:
Blink Blink del.icio.ous Del.icio.us Digg Digg
Fark Fark Furl Furl Google Google
Reddit Reddit Simpy Simpy Spurl Spurl
Technorati Technorati Windows Live Win Live Yahoo Yahoo
Rate Me!
Avg Visitor Rating: Average Visitor Rating is 3.5 out of 5
Number of Ratings : 3 Votes
Rate:
Send Private MessageSend Message
Signup / Login To View the Solution or Provide Comments
Post Comment/Solution
Comment:*
        (Link Rules) 
  Use : [bold] for <b>; [/bold] for </b>; [italic] for <i>; [/italic] for </i>; [code] & [/code] for code
 
Categories
Options
JavaScript RSS Feed
Most Popular Tutorial
Most Popular Solution
Top Rated
Top Contributors
Yearly
Overall
 
1. jawahar (300)
bnrtop