javascript - onblur()..... really need your help..

Discussion in 'JavaScript and AJAX' started by hazrizal84, Jun 11, 2008.

  1. hazrizal84

    hazrizal84 New Member

    Jun 11, 2008
    Likes Received:
    Trophy Points:
    hi..i really need help from those who can solve my there are:

    <script language=javascript>
    function isNumberKey(evt)
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 47 || charCode > 57))
    return false;

    return true;
    <p>Please enter your answer or type ( / ) if you don't know the answer.<br>
    Your answer may not contain both numbers and ( / ) sign.<br><br>
    34 + 54 = <input type=text size="6" onkeypress="return isNumberKey(event)" onblur=""></p>
    <p>123 + 76 = <input type=text size="6" name="T1" onkeypress="return isNumberKey(event)" onblur=""></p>
    <input type=submit value="Check Answer!">

    User will be able to key in their answer in numerical form or just type slash ( / ) for unknown answer..the prob is, how can i build up the function in onblur() statement so that, when tab button been pressed to move to the other textbox, it will determine whether user key in number, slash or the combination of number and slash. message box will be popped up if user key in both number and slash in the space provided.
  2. shabbir

    shabbir Administrator Staff Member

    Jul 12, 2004
    Likes Received:
    Trophy Points:
    Moved from Java to JavaScript forum

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice