Script works correctly in Firefox, not in IE6

Discussion in 'Javascript' started by Paul E. Schoen, Sep 8, 2007.

  1. Sorry if this is a known problem with IE, but I was surprised to find that
    the following code snippet works OK in Firefox but not in IE6:

    else if (Form1.DogSex.value == "?") {
    alert ("Please select Dog Sex");
    Form1.DogSex.focus(); }

    The control is defined in a table as follows:

    <TR><TD>Sex of dog: </TD><TD> <SELECT NAME="DogSex">
    <OPTION>?</Option> <OPTION>Male</Option> <OPTION>Female</Option> </TD></TR>

    In Firefox the default "?" is recognized and the alert is displayed. In IE6
    it is not. Maybe there is a better way to detect that a viable option was
    not selected? My complete web page is at:

    http://www.smart.net/~pstech/DogLicenseJS.htm

    I had posted my initial newbie questions on the Microsoft Jscript NG, but
    my questions are probably applicable to JScript and JavaScript. I really
    don't know how to tell the difference.

    Thanks,

    Paul
     
    Paul E. Schoen, Sep 8, 2007
    #1
    1. Advertising

  2. "Randy Webb" <> wrote in message
    news:...
    > Paul E. Schoen said the following on 9/8/2007 1:55 AM:
    >> Sorry if this is a known problem with IE, but I was surprised to find
    >> that the following code snippet works OK in Firefox but not in IE6:
    >>
    >> else if (Form1.DogSex.value == "?") {
    >> alert ("Please select Dog Sex");
    >> Form1.DogSex.focus(); }
    >>
    >> The control is defined in a table as follows:
    >>
    >> <TR><TD>Sex of dog: </TD><TD> <SELECT NAME="DogSex">
    >> <OPTION>?</Option> <OPTION>Male</Option> <OPTION>Female</Option>
    >> </TD></TR>
    >>
    >> In Firefox the default "?" is recognized and the alert is displayed.

    >
    > But, it doesn't have a value attribute. That is well known about - to
    > some - that IE won't give it a value based on the text. Simple solution:
    >
    > <option value="?">?
    > <option value="Male">Male
    > <option value="Female">Female
    >


    That worked perfectly. Are there other inconsistencies among browers? Any
    way to find out what they are? I found some information on:
    http://www.quirksmode.org/js/intro.html
    http://developer.mozilla.org/en/docs/Migrate_apps_from_Internet_Explorer_to_Mozilla

    Thanks.

    Paul
     
    Paul E. Schoen, Sep 8, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ivor O'Connor
    Replies:
    4
    Views:
    855
    Isofarro
    Nov 25, 2003
  2. PeterKellner
    Replies:
    0
    Views:
    598
    PeterKellner
    Jun 1, 2006
  3. Nospam
    Replies:
    4
    Views:
    382
    Nospam
    Jan 27, 2007
  4. Dennis McCarthy

    CheckBoxField works in Firefox but not in IE6

    Dennis McCarthy, Jan 25, 2007, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    109
    Dennis McCarthy
    Jan 25, 2007
  5. David Springthorpe

    Works OK In IE6 But Not In Mozilla Firefox 0.9.2

    David Springthorpe, Aug 22, 2004, in forum: Javascript
    Replies:
    1
    Views:
    87
    Michael Winter
    Aug 22, 2004
Loading...

Share This Page