473,395 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

disable ctrl+s

The below code is to disable the ctrl+s functionality and triger to user defined function when we press ctrl+s...It is working fine in IE. In mozilla also its working fine but the problem here is, letter "S" is diabled when i want to add any word which is including "S" is not posiible in mozilla.

can any one please help on this.
Expand|Select|Wrap|Line Numbers
  1. document.onkeydown = disablekey;
  2. document.onhelp=processHelp;
  3. function disablekey(evtArg)
  4. {
  5.     var isIE = ( document.all ? true : false) ;
  6.     var KeyID=( document.all ? window.event.keyCode : evtArg.which) ;
  7.     var ctrlPressed =( document.all ? window.event.ctrlKey: evtArg.which);
  8.     if ( ctrlPressed && KeyID == 83 )
  9.     {
  10.         if( isIE )
  11.         {
  12.             handleKey(evtArg);
  13.             event.keyCode = 0;
  14.             return false;
  15.         }
  16.         else
  17.         {
  18.             handleKey(evtArg);
  19.             evtArg.preventDefault();
  20.             evtArg.stopPropagation();
  21.         }
  22.     }
  23.     else
  24.     {
  25.         handleKey(evtArg);
  26.     }
  27.  
  28. }
  29. function handleKey(evtArg)
  30. {    
  31.     var evt = ( document.all ? window.event : evtArg) ;
  32.     var isIE = ( document.all ? true : false) ;
  33.     var KeyID=( document.all ? window.event.keyCode : evtArg.which) ;
  34.     var skip=false;
  35.     ctrlPressed = evt.ctrlKey; 
  36.     //var ctrlPressed =( document.all ? window.event.ctrlKey: evtArg.which);
  37.     if( ctrlPressed && KeyID == 83 )
  38.     {    
  39.  
  40.         if(document.MAINFORM.activity.value=="CREATE_ORDER_CONFIRMATION")
  41.         {
  42.         completeCreateOrderConfirmation();
  43.  
  44.             if(!skip)
  45.             {
  46.  
  47.             if ( isIE )
  48.             {
  49.                 event.keyCode = 0;
  50.                 event.returnValue = false;
  51.                 return false;
  52.  
  53.             }
  54.             else
  55.             {
  56.                 evt.preventDefault();
  57.                 evt.stopPropagation();
  58.             }
  59.             } 
  60.     }
  61. }
  62. function processHelp()
  63. {
  64.     return false;
  65. }
Jun 23 '11 #1
1 5957
Dormilich
8,658 Expert Mod 8TB
how do you know that the control key has been pressed in Mozilla?
Jun 23 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Bob Bedford | last post by:
I create checkboxes using datas from a database (with PHP). I store all values in an array, as I must pass this value like a Form value. Now, in some cases, when a checkbox is selected, I must...
6
by: nntp | last post by:
I have a set of links which I want search engines to crawl them, but I want to disable them from my visitors, so I will ask the link owners to pay me to let me enable them. <a disabled...
12
by: Forti2ude | last post by:
Hello, I have a simple form... <form> <select name="foo" multiple> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> </select>
13
by: Rich | last post by:
Hello, So I would like to disable a textbox on a vb.net form without the text getting grayed out. In vb6 I could place a textbox control on a frame control and disable the frame leaving the...
4
by: Chris | last post by:
I have an asp.net page say page1.aspx. The form in html code is <form id = "Form1"> And i want to disable all the fields of the form after some code steps. I had created a javascript funct: ...
0
by: Ahmad Jalil Qarshi | last post by:
Hi! I have a problem while developing some webpages.The Problem is that:- How We Can Disable The Controls Of One Web Form From Other Web Form In Asp.net? Explanation:- There Should Be Two...
8
by: prado | last post by:
I want to disable a table with javascript. In this table i have 'n' record and each record has 3 buttons. If you click a button does an action. I want to disable the all table. is there any way...
4
by: Phoe6 | last post by:
Hi all, I am trying to disable the NIC card (and other cards) enabled in my machine to test diagnostics on that card. I am trying to disable it programmatic using python. I checked python wmi and...
0
by: sainiranji | last post by:
Hi All I have diffrent categories in diffrrent logging purpose and all are working fine...but now my requirment is to disable all at once . The below are change i did for disable all logges...
8
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I disable the right mouse button? -----------------------------------------------------------------------...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.