No. No sane browser / OS setup will let a webpage 'lock the keyboard or mouse'. Think for 30 seconds why this is the case.
If you want to disable all interaction with your site when the user clicks something.. oh-k, something like document.body.disabled = true/false; should suffice, although I can't see why you'd want to do this.
The other case, actually locking the keyboard or mouse system-wide; no chance. Even some application programming languages ( non-web ) wont let you do this. I'm sure your individual motives are good, but that's far from the point.
Maybe throw a little popup window that says 'please unplug your peripherals'... O_o
I think I misused the word lock, I don't really know the exact term, but it was something like it disables the use of left click (maybe). When you left click on a certain area, you cannot click on any of the buttons, but if you click again back to that area, it will enable you to click again (left click). Oh well, I'll just try to find that script again, thank you sir. :)