www.webdeveloper.com
Results 1 to 6 of 6

Thread: Question on using logical operators

  1. #1
    Join Date
    Aug 2004
    Location
    Maryland
    Posts
    34

    Question Question on using logical operators

    Hello:
    Everything I've read tells me that this script should work in a form but it doesn't. Does anyone know what I'm getting wrong?

    Zip Code (5 Numbers): &nbsp <input name="zip" type="text" value="" onchange="if (this.value.length < 5) || if (isNaN(this.value)) alert('Please enter your zip code.')"><br><br>
    wtschulz

  2. #2
    Join Date
    Nov 2002
    Location
    Nashua, NH
    Posts
    3,195
    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.

  3. #3
    Join Date
    Aug 2004
    Location
    Maryland
    Posts
    34

    Re: Question on using logical operators

    Thank you, that's what I really need is something that explains the process. That's better than a solution because I'll be able to figure it out myself next time.

    Thanks again,
    wtschulz

  4. #4
    Join Date
    Nov 2002
    Location
    Nashua, NH
    Posts
    3,195

    Re: Re: Question on using logical operators

    Originally posted by wtschulz
    Thank you, that's what I really need is something that explains the process. That's better than a solution because I'll be able to figure it out myself next time.

    Thanks again,
    That is rare and refreshing attitude for these fora, you are welcome
    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.

  5. #5
    Join Date
    Aug 2004
    Location
    Maryland
    Posts
    34

    Thumbs up

    Vladdy:
    With your help, here's what I came up with (and it works!):

    <!--Validate that the length of the birth year field is 4 and all numbers-->
    Zip Code (5 Numbers): &nbsp <input name="zip" type="text" value="" onchange="if((this.value.length != 4) || (isNaN(this.value))) alert('Please enter your Birth Year.')">

    I'm trying to do as much "in-line" (actually on the text fields using "onchange" and "onblur" as I can and will use actual functions to clean-up what-ever I can't do in line using "onsubmit". Again, thanks so much for your help!
    wtschulz

  6. #6
    Join Date
    Aug 2004
    Location
    Maryland
    Posts
    34

    Help with Logical Operators

    Oops, I had two fields mixed together. Here's what I used:

    <!--Validate that the length of the Birth Year field is 4 and all numbers-->
    Birth Year: (4 Numbers): &nbsp <input name="Byear" type="text" value="" onchange="if((this.value.length != 4) || (isNaN(this.value))) alert('Please enter your birth year.')">
    wtschulz

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles