LATEST >>

Welcome Here And Thanks For Visiting. Like Us On Facebook...

EXEIdeas – Let's Your Mind Rock » HTML-CSS-PHP-JavaScript / JavaScript Codes » How To Stop Working Of A Keyboard Key Function In Your Blog Or Site?

How To Stop Working Of A Keyboard Key Function In Your Blog Or Site?

How To Stop Working Of A Keyboard Key Function In Your Blog Or Site?

Many designers and developers add awesome function to there site link sliding onclick or any other function that can also be done with keyboard keys so who that are using only keyboard can’t view there awesome work so he needs to stop function of keyboards keys so the visitor must click on the button using mouse so he can see the real and awesome work of designer.

For this purpose, there are many codes but here we have the shortest code that will block visitor keyboard keys on your blog or site so then he must have to click on your suggested button to view your awesome work. In this pure JavaScript that is cross browsers, you cam add as many keyboards keys chrac codes as you want to stop there function on your webpage only.

There are many other usage of this code and if you are a designer then you know completely so ow without any more preface, just see the features of this code and garb the code from below.

Features:

1.) Pure JavaScript Code.
2.) No HTML, CSS, JQuery.
3.) Easy To Add And Quick To Run.
4.) Cross Browsers Support.
5.) It Can Block Unlimited Keys.
6.) Easy To Customize.
7.) Short Code.
8.) Will Not Conflict.
9.) Best Way To Secure Your Data.
10.) Stop Function Of Any Key While It Will Be Pressing.

How To Add In Blogspot?

1.) Go To Your www.blogger.com
2.) Open Your Desire “Blog“.
3.) Go To “Layout“.
4.) Click “Add A Gadget” Where You Want To Add It.
5.) Now Scroll To “HTML-JAVASCRIPT
6.) Click “+” Icon To Add It.
7.) Now Copy The Below Code And Paste It To There.
8.) Leave The Title Empty.
9.) Click “Save“, Now You Are Done.

Recommended For You:
Show/Hide DIV Using JavaScript Toggle Button

How To Add In Website?

1.) Just Go To Your HTML File.
2.) Now Copy The Below Code And Paste It Between “<head> </head>“.
3.) “Save” It, Now You Are Done.

<script type='text/javascript'>
// Stop Working Of Keyboard Keys
// Code From: www.exeideas.com
window.addEventListener("keydown", function(exe) {
if([36, 35, 33, 34, 32, 37, 38, 39, 40].indexOf(exe.keyCode) &gt; -1) {
exe.preventDefault();
}
}, false);
</script>

Customization:

Just Add Your Desired KeyCode At 36, 35, 33, 34, 32, 37, 38, 39, 40 After A Comma And Save Your Page. Its Done. Nothing To Do More. If You Want To Get More Chrac Codes Of Your Other Keyboard Keys Then Get It IN Our New Article At List Of All Keyboard Keys JavaScript Char Codes (Key Codes).

Last Words:

This is what we have and as per our rule, we shared it with you. Now if you liked this then share it with your friends and leave your feedback and if you have any query related to this code, You can contact us freely and we will reply you as fast as we can. Stay with us because we have something more for you in our next post. Have a nice life!

Recommended For You:
JavaScript Audio Waveform Visualizer Player With Pure Vanilla JavaScript

You Like It, Please Share This Recipe With Your Friends Using...

Be the first to write a comment.

Leave a Reply

Your email address will not be published. Required fields are marked *