OnClick-problem with Netscape

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gerard van Wilgen

    #1

    OnClick-problem with Netscape

    I noticed that the following line of code works in IE 6 but not in Netscape
    7.1:

    <INPUT TYPE="radio" NAME="selComb" VALUE="0"
    ONCLICK="alert( selComb[0].value)">

    Nothing happens when I click on the radio button. There is not even an error
    message.

    This is a simplified version of the actual code, which is used to pass among
    other things the value of a selected radio button to a JavaScript-function.
    Does anybody know how this code can be made to work in Netscape?


    Gerard van Wilgen
    --
    www.majstro.com (On-line translation dictionary / Enreta tradukvortaro)
    www.travlang.com/Ergane (Free translation dictionary for Windows / Senpaga
    tradukvortaro por Windows)

  • Dennis Biletsky

    #2
    Re: OnClick-problem with Netscape


    "Gerard van Wilgen" <gvanwilgen@pla net.nl> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ
    ÓÌÅÄÕÀÝÅÅ: news:c7qd6m$ic2 $1@reader11.wxs .nl...[color=blue]
    > I noticed that the following line of code works in IE 6 but not in[/color]
    Netscape[color=blue]
    > 7.1:
    >
    > <INPUT TYPE="radio" NAME="selComb" VALUE="0"
    > ONCLICK="alert( selComb[0].value)">
    >
    > Nothing happens when I click on the radio button. There is not even an[/color]
    error[color=blue]
    > message.
    >
    > This is a simplified version of the actual code, which is used to pass[/color]
    among[color=blue]
    > other things the value of a selected radio button to a[/color]
    JavaScript-function.[color=blue]
    > Does anybody know how this code can be made to work in Netscape?
    >
    >
    > Gerard van Wilgen
    > --
    > www.majstro.com (On-line translation dictionary / Enreta tradukvortaro)
    > www.travlang.com/Ergane (Free translation dictionary for Windows / Senpaga
    > tradukvortaro por Windows)
    >[/color]
    I have checked on Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6)
    Gecko/20040206 Firefox/0.8. It's not a Netscape but the same engine. It
    works fine. Sorry, but I couldn't check it on Netscape, but I think no
    difference with Mozilla


    Comment

    • Mick White

      #3
      Re: OnClick-problem with Netscape

      Gerard van Wilgen wrote:
      [color=blue]
      > I noticed that the following line of code works in IE 6 but not in Netscape
      > 7.1:
      >
      > <INPUT TYPE="radio" NAME="selComb" VALUE="0"
      > ONCLICK="alert( selComb[0].value)">[/color]

      You may need <form> tags, and the reference "this.form.selC omb[0].value".
      Mick
      [color=blue]
      >
      > Nothing happens when I click on the radio button. There is not even an error
      > message.
      >
      > This is a simplified version of the actual code, which is used to pass among
      > other things the value of a selected radio button to a JavaScript-function.
      > Does anybody know how this code can be made to work in Netscape?
      >
      >
      > Gerard van Wilgen[/color]

      Comment

      • mscir

        #4
        Re: OnClick-problem with Netscape

        Gerard van Wilgen wrote:[color=blue]
        > I noticed that the following line of code works in IE 6 but not in Netscape
        > 7.1:
        >
        > <INPUT TYPE="radio" NAME="selComb" VALUE="0"
        > ONCLICK="alert( selComb[0].value)">
        >
        > Nothing happens when I click on the radio button. There is not even an error
        > message.
        >
        > This is a simplified version of the actual code, which is used to pass among
        > other things the value of a selected radio button to a JavaScript-function.
        > Does anybody know how this code can be made to work in Netscape?
        >
        > Gerard van Wilgen[/color]

        If you want to pass the radio button value to a function, how about

        onlick="alert(t his.value);"

        If you want to access the values of radio buttons in a form, you can do
        it using the forms collection and form elements collection. You can
        access the form by it's number or by it's name:

        document.forms['formname']
        document.forms[formumber]

        To access a radio button, you can use its element number in the form, or
        it's name and index number, which might be more convenient if you have
        several mixed types of form elements:

        Selcomb 0 <input type="radio" name="selComb" value="0"
        onclick="alert( document.forms['frmData'].elements[0].checked)">
        Selcomb 1 <input type="radio" name="selComb" value="1"
        onclick="alert( document.forms[0].elements[0].checked)">
        Selcomb 2 <input type="radio" name="selComb" value="2"
        onclick="alert( document.forms['frmData'].selComb[0].checked)">
        Selcomb 3 <input type="radio" name="selComb" value="3"
        onclick="alert( document.forms[0].elements[selComb,[0]].checked)">

        Mike

        Comment

        • Gerard van Wilgen

          #5
          Re: OnClick-problem with Netscape


          "mscir" <mscir@access4l ess.com.net.org .uk> wrote in message
          news:10a2fn0kla 1po0a@corp.supe rnews.com...[color=blue]
          > Gerard van Wilgen wrote:[color=green]
          > > I noticed that the following line of code works in IE 6 but not in[/color][/color]
          Netscape[color=blue][color=green]
          > > 7.1:
          > >
          > > <INPUT TYPE="radio" NAME="selComb" VALUE="0"
          > > ONCLICK="alert( selComb[0].value)">
          > >
          > > Nothing happens when I click on the radio button. There is not even an[/color][/color]
          error[color=blue][color=green]
          > > message.
          > >
          > > This is a simplified version of the actual code, which is used to pass[/color][/color]
          among[color=blue][color=green]
          > > other things the value of a selected radio button to a[/color][/color]
          JavaScript-function.[color=blue][color=green]
          > > Does anybody know how this code can be made to work in Netscape?
          > >
          > > Gerard van Wilgen[/color]
          >
          > If you want to pass the radio button value to a function, how about
          >
          > onlick="alert(t his.value);"[/color]

          Thanks, that works.
          [color=blue]
          > If you want to access the values of radio buttons in a form, you can do
          > it using the forms collection and form elements collection. You can
          > access the form by it's number or by it's name:[/color]

          Okay, that works too. I do not even have to use the collections; putting the
          input tags in a form is apparently enough.

          I shall use the the first solution, because I do not really need a form
          (nothing to submit to the server here).


          Gerard van Wilgen
          --
          www.majstro.com (On-line translation dictionary / Enreta tradukvortaro)
          www.travlang.com/Ergane (Free translation dictionary for Windows / Senpaga
          tradukvortaro por Windows)

          Comment

          • G Roydor

            #6
            Re: OnClick-problem with Netscape

            <INPUT TYPE="radio" NAME="selComb" VALUE="0"
            ONCLICK="alert( selComb.value)" >

            Gerard van Wilgen a écrit:[color=blue]
            > I noticed that the following line of code works in IE 6 but not in Netscape
            > 7.1:
            >
            > <INPUT TYPE="radio" NAME="selComb" VALUE="0"
            > ONCLICK="alert( selComb[0].value)">
            >
            > Nothing happens when I click on the radio button. There is not even an error
            > message.
            >
            > This is a simplified version of the actual code, which is used to pass among
            > other things the value of a selected radio button to a JavaScript-function.
            > Does anybody know how this code can be made to work in Netscape?
            >
            >
            > Gerard van Wilgen[/color]

            Comment

            Working...