Why isn't this code working

Results 1 to 3 of 3

Thread: Why isn't this code working

  1. #1
    Tom H Guest

    Default Why isn't this code working

    It works when i use the OR operator but not the AND. Do you know the problem?<BR><BR><BR>function checkData()<BR><BR>{<BR><BR>correct = true<BR><BR>if ((document.FormInsert.ReferenceID.value == "3") && (document.FormInsert.Answer_C ==""))<BR><BR>{correct = false; alert("Please enter an answer for C.")}<BR>return correct<BR>}

  2. #2
    Join Date
    Dec 1969

    Default A typo

    It works with OR because there is a typo in your statement, causing one of the results to be false.<BR><BR>document.FormInsert.Answer_C ==""<BR><BR>Do you see it? Change it to<BR><BR>document.FormInsert.Answer_C.value ==""

  3. #3
    Tom H Guest

    Default RE: A typo

    Thanks, you the man

Posting Permissions

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