Script works correctly in Firefox, not in IE6

P

Paul E. Schoen

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
 
P

Paul E. Schoen

Randy Webb said:
Paul E. Schoen said the following on 9/8/2007 1:55 AM:

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,732
Latest member
ArronPalin

Latest Threads

Top