click() question

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

    click() question


    I want to programatically force click a certain radio button named
    "fourdp".

    A click(fourdp) ; returns an undefined error.
    What am I doing wrong?


    --
    Many thanks,

    Don Lancaster
    Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
    voice: (928)428-4073 email: don@tinaja.com fax 847-574-1462

    Please visit my GURU's LAIR web site at http://www.tinaja.com

  • Douglas Crockford

    #2
    Re: click() question

    > I want to programatically force click a certain radio button named[color=blue]
    > "fourdp".
    >
    > A click(fourdp) ; returns an undefined error.
    > What am I doing wrong?[/color]

    html objects are in a distinct space from JavaScript objects. You have to use an
    accessor method like

    document.getEle mentById('fourd p').click();

    where fourdp is the id (not necessarily the name) of the element.

    More hints here: http://www.crockford.com/#javascript

    Comment

    • Don Lancaster

      #3
      Re: click() question

      Douglas Crockford wrote:[color=blue]
      >[color=green]
      > > I want to programatically force click a certain radio button named
      > > "fourdp".
      > >
      > > A click(fourdp) ; returns an undefined error.
      > > What am I doing wrong?[/color]
      >
      > html objects are in a distinct space from JavaScript objects. You have to use an
      > accessor method like
      >
      > document.getEle mentById('fourd p').click();
      >
      > where fourdp is the id (not necessarily the name) of the element.
      >
      > More hints here: http://www.crockford.com/#javascript[/color]

      If I try adding an ID="fourdp" etc to the radio buttons, the return
      error message is

      OBJECT DOESN'T SUPPORT THIS PROPERTY OR METHOD.

      Can a radio button have an ID?


      --
      Many thanks,

      Don Lancaster
      Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
      voice: (928)428-4073 email: don@tinaja.com fax 847-574-1462

      Please visit my GURU's LAIR web site at http://www.tinaja.com

      Comment

      • Douglas Crockford

        #4
        Re: click() question

        > > > I want to programatically force click a certain radio button named[color=blue][color=green][color=darkred]
        > > > "fourdp".
        > > >
        > > > A click(fourdp) ; returns an undefined error.
        > > > What am I doing wrong?[/color]
        > >
        > > html objects are in a distinct space from JavaScript objects. You have to[/color][/color]
        use an[color=blue][color=green]
        > > accessor method like
        > >
        > > document.getEle mentById('fourd p').click();
        > >
        > > where fourdp is the id (not necessarily the name) of the element.
        > >
        > > More hints here: http://www.crockford.com/#javascript[/color]
        >
        > If I try adding an ID="fourdp" etc to the radio buttons, the return
        > error message is
        >
        > OBJECT DOESN'T SUPPORT THIS PROPERTY OR METHOD.
        >
        > Can a radio button have an ID?[/color]

        Sure they can. Make sure they each have a different id.

        Comment

        • Don Lancaster

          #5
          Re: click() question

          Douglas Crockford wrote:[color=blue]
          >[color=green][color=darkred]
          > > > > I want to programatically force click a certain radio button named
          > > > > "fourdp".
          > > > >
          > > > > A click(fourdp) ; returns an undefined error.
          > > > > What am I doing wrong?
          > > >
          > > > html objects are in a distinct space from JavaScript objects. You have to[/color][/color]
          > use an[color=green][color=darkred]
          > > > accessor method like
          > > >
          > > > document.getEle mentById('fourd p').click();
          > > >
          > > > where fourdp is the id (not necessarily the name) of the element.
          > > >
          > > > More hints here: http://www.crockford.com/#javascript[/color]
          > >
          > > If I try adding an ID="fourdp" etc to the radio buttons, the return
          > > error message is
          > >
          > > OBJECT DOESN'T SUPPORT THIS PROPERTY OR METHOD.
          > >
          > > Can a radio button have an ID?[/color]
          >
          > Sure they can. Make sure they each have a different id.[/color]

          Finally worked it out.

          form.hominydp.f ourdp.click() ;

          apparently works properly


          --
          Many thanks,

          Don Lancaster
          Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
          voice: (928)428-4073 email: don@tinaja.com fax 847-574-1462

          Please visit my GURU's LAIR web site at http://www.tinaja.com

          Comment

          Working...