www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > JavaScript

    JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...)

    Reply
     
    Thread Tools Rate Thread Display Modes
      #1  
    Old 06-25-2004, 06:30 AM
    k0r54 k0r54 is offline
    CSS,PHP enthusiast
     
    Join Date: Jun 2004
    Posts: 1,294
    Disable Backspace

    Hi,

    Just a quicky how can i disable the backspace. I have found code for the enter key but dont understand it. So any help will be great thanks

    <script language="JavaScript" type="text/javascript">

    function checkCR(evt) {

    var evt = (evt) ? evt : ((event) ? event : null);

    var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);

    if ((evt.keyCode == 13) && (node.type=="text")) {return false;}

    }

    document.onkeypress = checkCR;

    </script>

    Tnx Adz
    Reply With Quote
      #2  
    Old 06-25-2004, 07:50 AM
    Vladdy's Avatar
    Vladdy Vladdy is offline
    Helper, not pleaser
     
    Join Date: Nov 2002
    Location: Nashua, NH
    Posts: 3,222
    The question that needs to be answered first is why would you want to do that?
    __________________
    Vladdy

    Working web site is not the one that looks the same in a few graphical browsers, but the one that adequately delivers its content to any device accessing it.
    Reply With Quote
      #3  
    Old 06-25-2004, 08:44 AM
    k0r54 k0r54 is offline
    CSS,PHP enthusiast
     
    Join Date: Jun 2004
    Posts: 1,294
    The reason why is because, at work our agents use webscript and on the web script there is an ocx, but when you press back space it goes back a page and i cant do anything about it.

    So the best way is to disable backspace on that page.

    Thanks Adam
    Reply With Quote
      #4  
    Old 06-25-2004, 09:03 AM
    Vladdy's Avatar
    Vladdy Vladdy is offline
    Helper, not pleaser
     
    Join Date: Nov 2002
    Location: Nashua, NH
    Posts: 3,222
    Get ASCII chart, lookup code for "Backspace" and replace 13 with it.
    __________________
    Vladdy

    Working web site is not the one that looks the same in a few graphical browsers, but the one that adequately delivers its content to any device accessing it.
    Reply With Quote
      #5  
    Old 06-25-2004, 09:22 AM
    k0r54 k0r54 is offline
    CSS,PHP enthusiast
     
    Join Date: Jun 2004
    Posts: 1,294
    i have number 8

    Here

    but it dont work

    i tried that first of all
    Reply With Quote
      #6  
    Old 06-25-2004, 09:28 AM
    Vladdy's Avatar
    Vladdy Vladdy is offline
    Helper, not pleaser
     
    Join Date: Nov 2002
    Location: Nashua, NH
    Posts: 3,222
    Then, I guess, the browser catches the event before it is passed to the page, which means you are out of luck.
    __________________
    Vladdy

    Working web site is not the one that looks the same in a few graphical browsers, but the one that adequately delivers its content to any device accessing it.
    Reply With Quote
      #7  
    Old 06-25-2004, 12:14 PM
    fredmv's Avatar
    fredmv fredmv is offline
    Moderator
     
    Join Date: Jul 2003
    Location: Boston Area, Massachusetts
    Posts: 3,497
    Maybe try listening for it onkeydown instead of onkeypress. You might be able to catch the event that way.
    Reply With Quote
      #8  
    Old 09-14-2004, 11:11 PM
    TNO's Avatar
    TNO TNO is offline
    The New Objective
     
    Join Date: Sep 2004
    Location: Earth
    Posts: 292
    Try This:

    <script type="text/javascript">

    if (typeof window.event != 'undefined')
    document.onkeydown = function()
    {
    if (event.srcElement.tagName.toUpperCase() != 'INPUT')
    return (event.keyCode != 8);
    }
    else
    document.onkeypress = function(e)
    {
    if (e.target.nodeName.toUpperCase() != 'INPUT')
    return (e.keyCode != 8);
    }

    </script>
    Reply With Quote
      #9  
    Old 10-24-2006, 06:30 AM
    Lymedo Lymedo is offline
    Registered User
     
    Join Date: Oct 2006
    Posts: 1
    Smile Thanks

    You don't know how long I have been looking for some code that would work on a data access page....THIS DOES! Thanks
    Reply With Quote
      #10  
    Old 10-25-2006, 11:24 AM
    TNO's Avatar
    TNO TNO is offline
    The New Objective
     
    Join Date: Sep 2004
    Location: Earth
    Posts: 292
    Wow, I forgot I was still submitted to get a reply to this 2 year old thread.
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools
    Display Modes Rate This Thread
    Rate This Thread:

    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 Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 01:13 PM.



    Acceptable Use Policy

    Internet.com
    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.