Results 1 to 3 of 3

Thread: Re: question here by a dummy

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Posts
    101

    Re: question here by a dummy

    How do i make a check on the first digit and second digit of textbox - not the actuall whole value of the textbox but only the first and second digit, regardless of how many digits there are in the actuall value of the textbox because i want to perform an action if the first character that is entered in the textbox is equal to 0. thanks

  2. #2
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    Code:
    <script language="JavaScript">
      function checkValue(textboxValue) {
         textboxValue = textboxValue.value;
         if (textboxValue[0] == 0) {
            // write code here
         }
      }
    </script>
    Code:
    <form name="formName" method="post" action="#">
    <input type="text" name="textBox" onBlur="checkValue(this);">
    </form>
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  3. #3
    Hyperactive Member bsw2112's Avatar
    Join Date
    Nov 2001
    Location
    ottawa, canada
    Posts
    292
    <html><head>

    <script language="JavaScript">
    function checkValue(textboxValue) {
    t = textboxValue.textBox.value;

    if (t.charAt(0) == 0 || t.charAt(1) == 0 )
    {
    alert("yes it's a zero");
    }
    }
    </script>

    </script></head>
    <body>

    <form name="formName" method="post" action="#">
    <input type="text" name="textBox" onBlur="checkValue(formName);">
    <input type="text" name="dd" >
    <input type = "button">
    </form>
    </body>
    </html>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width