Results 1 to 2 of 2

Thread: If field1 = MO and field2 = Red then write ??

  1. #1
    Join Date
    Jan 2006

    If field1 = MO and field2 = Red then write ??

    Hello I'm pulling data into my page from a txt file. Currently I show certain data based on the State and you can see below that my script will pull in field1 which is my state field and if it is MO then it will write a message "This is Missouri". If it is not MO the script just writes a blank.

    I want to add to this script a second field2 and then when both field1 and field2 are matched with the data then it shows a message. I'm not sure how to incorporate a second var and if statement.

    Example of what I want:
    If field1 = MO and field2 = Red then write "This is Missouri and there is an alert"

    var doc1 = "[[field1]]"
    if (doc1 == "MO") {
    document.write("This is Missouri")
    else {
    document.write(" ")

    Thanks for the help!
    Last edited by HDC; 05-04-2009 at 11:14 AM.
    www.unitingbands.com - Where Talents Unite!

  2. #2
    Join Date
    May 2003
    Between Baltimore and DC
    Learn about Logical Operators: https://developer.mozilla.org/en/Cor...ical_Operators

    Tech Author [Ajax In Action, JavaScript: Visual Blueprint] | twitter | linkedin | http://www.pascarello.com

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