Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
surpress defaul cntrl codes
Old 06-20-2011, 08:45 AM surpress defaul cntrl codes
numbenator's Avatar
Webmaster Talker

Posts: 523
Location: London
Trades: 0
Hi everyone

does any one know how to surpress the browser default cntrl codes like cntrl S, cntrl A

I have written some cntrl functions in jquery that perform tasks but once complete, the default cntrl code functionality always kicks in.

any help on this would be appreciated.

cheers
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
 
Register now for full access!
Old 06-20-2011, 10:59 AM Re: surpress defaul cntrl codes
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Just return false from your event handler (as in your other TWO threads).
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-20-2011, 11:04 AM Re: surpress defaul cntrl codes
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://javascript.about.com/library/bldisdef.htm
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-20-2011, 11:13 AM Re: surpress defaul cntrl codes
numbenator's Avatar
Webmaster Talker

Posts: 523
Location: London
Trades: 0
I AM!

Code:
$.ctrl = function(key, callback, args) {
			var isCtrl = false;
			$(document).keydown(function(e) {
			if(!args) args=[]; // IE barks when args is null
		
				if(e.ctrlKey) isCtrl = true;
					if(e.keyCode == key.charCodeAt(0) && isCtrl) {
						callback.apply(this, args);
						isCtrl = false;
						return false;
					}
				else{
					isCtrl = false;
				}
			});
		};
		
		$.ctrl('S', function() {
   			 saveRestaurant.save();		
			 return false;
		});
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
Old 06-20-2011, 04:53 PM Re: surpress defaul cntrl codes
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
I dont know if this will solve your issue or not, but the code you're using (from the link I provided in your previous thread) had an updated version a bit lower down on the page. For starters you might wanna use that instead :P
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is online now
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 06-20-2011, 04:55 PM Re: surpress defaul cntrl codes
numbenator's Avatar
Webmaster Talker

Posts: 523
Location: London
Trades: 0
Thanks lizciz. Will give it a go.
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
Reply     « Reply to surpress defaul cntrl codes
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16912 seconds with 12 queries