HTML
  Home arrow HTML arrow Page 5 - More on the Keyboard for a Web Page Calcul...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

More on the Keyboard for a Web Page Calculator
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-04-01

    Table of Contents:
  • More on the Keyboard for a Web Page Calculator
  • The processKey(e) Function
  • Details of the processKey(e) Code segments
  • The Second if (else if) block
  • The Fourth if (else if) block

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    More on the Keyboard for a Web Page Calculator - The Fourth if (else if) block


    (Page 5 of 5 )

    The fourth if (else if) block is:


    else if (keynum == "13") //for the equal sign

    {

    ID = "BEQ";

    //call the showNum() function with the ID

    operator(ID);

    //give the button focus

    document.getElementById(ID).focus();

    }


    The “if else” line checks to see if the Enter key was pressed. If it was, it assigns the ID (‘BEQ’) of the corresponding calculator button. The block then goes on to call the operator(ID) function using the ID. Remember that the operator(ID) function does the evaluation. It does it through this block.

    We have pressed the Enter key on the keyboard. This has to be equivalent to clicking the corresponding button (=) on the calculator. So this corresponding button on the calculator has to receive focus. The last line of the block gives the button focus.

    Now you may ask, “Is this not repetition? We handled the equal sign in the previous block. Why do it again?” Well, on the keyboard, the Equal Sign key does not have the same key code as the Enter key. The user may decide to press the Equal Sign key or the Enter key. So we have to handle both cases.

    The next question you may ask is, why have I used (keynum == "13") and not (keychar == "Some Enter Character") in the last “if else” line? Systems may not retrieve the character.

    We have come to the end of this section. We continue in the next part with scientific functions.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

    HTML ARTICLES

    - Hello HTML 5, Goodbye Gears
    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers







    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek