JavaScript problem in Netscape 7.1

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rick

    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?


  • kaeli

    #2
    Re: JavaScript problem in Netscape 7.1

    In article <uoRsb.57425$Ec 1.3526832@bgtns c05-news.ops.worldn et.att.net>,
    72242.3603@comp userve.com enlightened us with...[color=blue]
    > 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 )[/color]

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

    --
    ~kaeli~
    A plateau is a high form of flattery.



    Comment

    • DU

      #3
      Re: JavaScript problem in Netscape 7.1

      Rick wrote:
      [color=blue]
      > 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 )[/color]

      status is not (and never was) a valid attribute or property for a radio
      button
      [color=blue]
      > { selected = true }
      > }[/color]


      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.
      [color=blue]
      > 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.[/color]

      I doubt that. status never was a valid property nor valid attribute of a
      radio button, even in MSIE.
      [color=blue]
      > 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?
      >
      >[/color]

      DU

      Comment

      • DU

        #4
        Re: JavaScript problem in Netscape 7.1

        kaeli wrote:
        [color=blue]
        > In article <uoRsb.57425$Ec 1.3526832@bgtns c05-news.ops.worldn et.att.net>,
        > 72242.3603@comp userve.com enlightened us with...
        >[color=green]
        >>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 )[/color]
        >
        >
        > try
        > if (form.yesno[i].selected == true)
        >[/color]

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

        DU

        Comment

        • kaeli

          #5
          Re: JavaScript problem in Netscape 7.1

          In article <bp1t0b$fht$2@n ews.eusc.inter. net>,
          drunclear@hotWI PETHISmail.com enlightened us with...[color=blue][color=green]
          > >[/color]
          >
          > selected is for option; checked is for radio and checkbox buttons.
          >
          > DU
          >
          >[/color]

          I'll keep those straight one of these days.
          Thanks.


          --
          ~kaeli~
          A lot of money is tainted - It taint yours and it taint mine.



          Comment

          • Thomas 'PointedEars' Lahn

            #6
            Re: JavaScript problem in Netscape 7.1

            Rick wrote:
            [color=blue]
            > I have an html program [...][/color]

            JFTR: Since HTML is the HyperText Markup Language, not a programming
            language like JavaScript, you have an HTML document, not an HTML program.


            PointedEars

            Comment

            Working...