473,320 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 1561
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.