Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8184543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:32:27+00:00 2026-06-07T01:32:27+00:00

The code that I am using below works fine, except for the fact that

  • 0

The code that I am using below works fine, except for the fact that it adds an ‘s’ if the cursor is left in an input field. How do I do a CTRL–S without having that pesky s being added?

window.onload = function() {

//-------------------------------------------------------------------->>
// CTRL-S FEATURE:
//-------------------------------------------------------------------->>
var isCtrl = false; 
document.attachEvent('onkeyup', KeyUpHandler); 
document.attachEvent('onkeydown', KeyDownHandler); 

function KeyUpHandler() {
    if (event.keyCode == 17) { 
    isCtrl = false; 
    }
}//end of function 

function KeyDownHandler() {
    if (event.keyCode == 17) { isCtrl = true }
    if (event.keyCode == 83 && isCtrl == true) {
    v8_update()
    } 
}//end of function

}//end of onload()

Much thanks and appreciation for all your help and support in advance,

Cheers

Jay

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T01:32:29+00:00Added an answer on June 7, 2026 at 1:32 am

    The keydown handler should prevent the default action from continuing — i.e. the character being inserted into the focused element. To accomplish this, use the preventDefault method of the event object:

    function KeyDownHandler(evnt) {
        var evnt = evnt || window.event;
        if (evnt.keyCode == 83 && evnt.ctrlKey) {
            evnt.preventDefault ? evnt.preventDefault() : window.event.returnValue = false;
            v8_update();
            return false;
        }
    }
    

    On can also return false to stop propagation AND prevent default, however, this may be detrimental to other events that are bound to the same element as your event — you may desire propagation, especially when attaching such an event to the document itself. If so, take out the false return.

    Try it here: http://jsfiddle.net/LzezS/

    Documentation

    • event.preventDefault on MDN – https://developer.mozilla.org/en/DOM:event.preventDefault
    • DOM event specification on W3 – http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-Event-preventDefault
    • MSDN and IE’s non-standard event model – http://msdn.microsoft.com/en-us/library/ie/ms534372%28v=vs.85%29.aspx
    • event.ctrlKey on MDN – https://developer.mozilla.org/en/DOM/event.ctrlKey
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code that works without using throw however when I use
I am using PHP 5.3.6 I have the following code below. Everything works fine
Below is the code that I'm using in ms access to list the data
I am using the below code, but I am not getting that why it
I'm trying to display a text using the code below. The problem is that
I came across the following code that compiles fine (using Visual Studio 2005): SomeObject
I am loading an image using the OpenEXR library. This works fine, except the
This block of code shown below using a php header redirect works locally, but
I am using code that i found on here which works great but the
I am trying to create images using .NET. Below is the code that I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.