469,923 Members | 1,777 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,923 developers. It's quick & easy.

JavaScript problem in Netscape 7.1

I have an html program with the following section of java script code:

var selected = false ;
for ( var i = 0; i <= 1 ; ++i ) {
if (form.yesno[i].status == true )
{ selected = true }
}
if ( selected == false ) {
alert ("Please indicate whether you have purchased from us before");
return false;
}
This portion of the html program validates a radio button on a form. It
essentially is supposed to return false if the user fails to check one of
the two button choices. The relevant portion of the form is here:

Have you purchased from us before?<br>
Yes
<input type="radio" name="yesno"

value="yes">
No
<input type="radio" name="yesno" value="no">

This code has worked fine for years, and it still works fine with IE.
However when you open the page in Netscape 7.1, it always returns "false",
regardless of what the user checks. Is there some error in the code that IE
is forgiving but that Nescape is picking up? Or is this a Netscape bug?
Jul 20 '05 #1
5 1504
In article <uo*********************@bgtnsc05-news.ops.worldnet.att.net>,
72********@compuserve.com enlightened us with...
I have an html program with the following section of java script code:

var selected = false ;
for ( var i = 0; i <= 1 ; ++i ) {
if (form.yesno[i].status == true )


try
if (form.yesno[i].selected == true)

--
~kaeli~
A plateau is a high form of flattery.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #2
DU
Rick wrote:
I have an html program with the following section of java script code:

var selected = false ;
for ( var i = 0; i <= 1 ; ++i ) {
if (form.yesno[i].status == true )
status is not (and never was) a valid attribute or property for a radio
button
{ selected = true }
}

try
for ( var i = 0; i <= 1 ; i++ )
{
if(form.yesno[i].checked)
{ selected = true; }
}

I think you should post-fix the incrementation so that you test
form.yesno[0] first.
if ( selected == false ) {
alert ("Please indicate whether you have purchased from us before");
return false;
}
This portion of the html program validates a radio button on a form. It
essentially is supposed to return false if the user fails to check one of
the two button choices. The relevant portion of the form is here:

Have you purchased from us before?<br>
Yes
<input type="radio" name="yesno"

value="yes">
No
<input type="radio" name="yesno" value="no">

This code has worked fine for years, and it still works fine with IE.
I doubt that. status never was a valid property nor valid attribute of a
radio button, even in MSIE.
However when you open the page in Netscape 7.1, it always returns "false",
regardless of what the user checks. Is there some error in the code that IE
is forgiving but that Nescape is picking up? Or is this a Netscape bug?


DU

Jul 20 '05 #3
DU
kaeli wrote:
In article <uo*********************@bgtnsc05-news.ops.worldnet.att.net>,
72********@compuserve.com enlightened us with...
I have an html program with the following section of java script code:

var selected = false ;
for ( var i = 0; i <= 1 ; ++i ) {
if (form.yesno[i].status == true )

try
if (form.yesno[i].selected == true)


selected is for option; checked is for radio and checkbox buttons.

DU

Jul 20 '05 #4
In article <bp**********@news.eusc.inter.net>,
dr*******@hotWIPETHISmail.com enlightened us with...


selected is for option; checked is for radio and checkbox buttons.

DU


I'll keep those straight one of these days.
Thanks.
--
~kaeli~
A lot of money is tainted - It taint yours and it taint mine.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #5
Rick wrote:
I have an html program [...]


JFTR: Since HTML is the HyperText Markup Language, not a programming
language like JavaScript, you have an HTML document, not an HTML program.
PointedEars
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.