.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Code Snippets >> Javascript >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Capturing control events Javascript : practical scenario

Posted By:Gaurav Arora       Posted Date: April 28, 2009    Points: 10    Category: Javascript    URL: http://www.dotnetspark.com  

This is the practical scenario where sometime one wants to disallow Ctl+keys combinitions on web-pages.

Following Code-snippet tells the whole story:


Test Key Combinition [Ctrl+A, Ctrl+N, Ctrl+C, Ctrl+X, Ctrl+V,Ctrl+J]

onKeyPress="return testCtrlKeys(event);"
onKeyDown="return testCtrlKeys(event);" />

1. Copy/paste above code in text file and save it as "nameddoc.html" and run it into Explorer
2. Check the magic of capturing javascript keys. .



Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend