Radio checking issue

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

    Radio checking issue

    Hi all

    How to check that "option A" is selected in the form?

    i have something like this:

    javascript:
    -------------------------------------------

    fnCheck(){
    if(document.frm 1.durationChang e[0]=='...don't know
    what..........' )
    {
    alert('selected A');
    }

    }

    html
    -----------------------------------------------

    <form name="frm1" >

    <input type="radio" name="durationC hange" value="1"option A

    <input type="radio" name="durationC hange" value="2"option B

    <input type="radio" name="durationC hange" value="3"option C

    <input type="submit" onClick="fnChec k();return(fals e);">
    </form>

    Thanks 4 help
    Sebastian
  • Thomas 'PointedEars' Lahn

    #2
    Re: Radio checking issue

    Sebastian wrote:
    How to check that "option A" is selected in the form?
    <news:47f56175$ 0$90274$1472629 8@news.sunsite. dk>


    PointedEars
    --
    Prototype.js was written by people who don't know javascript for people
    who don't know javascript. People who don't know javascript are not
    the best source of advice on designing systems that use javascript.
    -- Richard Cornford, cljs, <f806at$ail$1$8 300dec7@news.de mon.co.uk>

    Comment

    • Sebastian

      #3
      Re: Radio checking issue

      On 14 Apr, 12:37, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
      wrote:
      Sebastian wrote:
      How to check that "option A" is selected in the form?
      >
      <news:47f56175$ 0$90274$1472629 8@news.sunsite. dk>
      >
      Thanks i have it

      if(document.frm 1.durationChang e[0].checked==true)

      Sebastian

      Comment

      • Thomas 'PointedEars' Lahn

        #4
        Re: Radio checking issue

        Sebastian wrote:
        if(document.frm 1.durationChang e[0].checked==true)
        if (document.forms["frm1"].elements["durationChange "][0].checked)

        is less error-prone and more efficient.


        PointedEars
        --
        Prototype.js was written by people who don't know javascript for people
        who don't know javascript. People who don't know javascript are not
        the best source of advice on designing systems that use javascript.
        -- Richard Cornford, cljs, <f806at$ail$1$8 300dec7@news.de mon.co.uk>

        Comment

        Working...