delete/make invisible button?

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

    delete/make invisible button?

    Hello,

    I have a button which I wish to be invisible at the end of an
    application. How do delete it or simply make it invisible?

    Cheers

    Geoff
  • Martin Honnen

    #2
    Re: delete/make invisible button?



    Geoff Cox wrote:
    [color=blue]
    > I have a button which I wish to be invisible at the end of an
    > application. How do delete it or simply make it invisible?[/color]

    In the DOM as implemented in IE 5 and later, Mozilla, Netscape 6 and
    later, Opera 7 and later and other modern browsers you can remove any
    node by calling removeChild on its parent node e.g.
    node.parentNode .removeChild(no de);
    thus if you have a variable button with a reference to the button
    element you can do
    if (button.parentN ode && button.parentNo de.removeChild) {
    button.parentNo de.removeChild( button);
    }

    --

    Martin Honnen

    Comment

    • Geoff Cox

      #3
      Re: delete/make invisible button?

      On Sun, 04 Sep 2005 19:40:07 +0200, Martin Honnen <mahotrash@yaho o.de>
      wrote:
      [color=blue]
      >
      >
      >Geoff Cox wrote:
      >[color=green]
      >> I have a button which I wish to be invisible at the end of an
      >> application. How do delete it or simply make it invisible?[/color]
      >
      >In the DOM as implemented in IE 5 and later, Mozilla, Netscape 6 and
      >later, Opera 7 and later and other modern browsers you can remove any
      >node by calling removeChild on its parent node e.g.
      > node.parentNode .removeChild(no de);
      >thus if you have a variable button with a reference to the button
      >element you can do
      > if (button.parentN ode && button.parentNo de.removeChild) {
      > button.parentNo de.removeChild( button);
      > }[/color]

      Martin,

      Can you just explain how that would apply to my button which is
      created as part of the creation of a table ..

      document.write( "<input type='button' value='Next'
      onclick='next_q uestion()' />");

      After the "Next" button is clicked at the end of the exercise and the
      results are emailed to me I would like the button to become invisible
      so that the user is unable to press it again.

      Cheers

      Geoff

      Comment

      • Martin Honnen

        #4
        Re: delete/make invisible button?



        Geoff Cox wrote:

        [color=blue]
        > Can you just explain how that would apply to my button which is
        > created as part of the creation of a table ..
        >
        > document.write( "<input type='button' value='Next'
        > onclick='next_q uestion()' />");[/color]

        Well pass the button to your function e.g.

        <input type="button" onclick="next_q uestion(this);"

        and then in the function declaration you use a formal parameter

        function next_question (button) {

        and then wherever in the function you want to remove the button you use
        the suggested code e.g.

        if (button.parentN ode && button.parentNo de.removeChild) {
        button.parentNo de.removeChild( button);
        }

        --

        Martin Honnen

        Comment

        • Geoff Cox

          #5
          Re: delete/make invisible button?

          On Sun, 04 Sep 2005 20:36:59 +0200, Martin Honnen <mahotrash@yaho o.de>
          wrote:
          [color=blue]
          >Well pass the button to your function e.g.
          >
          > <input type="button" onclick="next_q uestion(this);"
          >
          >and then in the function declaration you use a formal parameter
          >
          > function next_question (button) {
          >
          >and then wherever in the function you want to remove the button you use
          >the suggested code e.g.
          >
          > if (button.parentN ode && button.parentNo de.removeChild) {
          > button.parentNo de.removeChild( button);
          > }[/color]

          Martin,

          Brilliant! Thanks that works fine - could you just say a word ot two
          about the use of "this"?

          Cheers

          Geoff

          Comment

          • RobG

            #6
            Re: delete/make invisible button?

            Geoff Cox wrote:
            [...][color=blue]
            >
            > Martin,
            >
            > Brilliant! Thanks that works fine - could you just say a word ot two
            > about the use of "this"?[/color]

            I think Mike Winter gets it mostly spot on here:

            <URL:http://groups.google.c om/group/comp.lang.javas cript/browse_frm/thread/9b041b9103b6de0 f/2065870c97d74b5 0?tvc=1&q=How+t o+understand+th e+javascript+cl ass+model%3F&hl =en#2065870c97d 74b50>



            --
            Rob

            Comment

            • Geoff Cox

              #7
              Re: delete/make invisible button?

              On Mon, 05 Sep 2005 06:48:20 +1000, RobG <rgqld@iinet.ne t.au> wrote:
              [color=blue]
              >Geoff Cox wrote:
              >[...][color=green]
              >>
              >> Martin,
              >>
              >> Brilliant! Thanks that works fine - could you just say a word ot two
              >> about the use of "this"?[/color]
              >
              >I think Mike Winter gets it mostly spot on here:
              >
              ><URL:http://groups.google.c om/group/comp.lang.javas cript/browse_frm/thread/9b041b9103b6de0 f/2065870c97d74b5 0?tvc=1&q=How+t o+understand+th e+javascript+cl ass+model%3F&hl =en#2065870c97d 74b50>[/color]


              Thanks Rob - will follow up on this - by the way one of the longest
              URL's I've seen!

              How do you get the link to the posting?

              Cheers

              Geoff

              Comment

              • RobG

                #8
                Re: delete/make invisible button?

                Geoff Cox wrote:[color=blue]
                > On Mon, 05 Sep 2005 06:48:20 +1000, RobG <rgqld@iinet.ne t.au> wrote:
                >
                >[color=green]
                >>Geoff Cox wrote:
                >>[...]
                >>[color=darkred]
                >>>Martin,
                >>>
                >>>Brilliant! Thanks that works fine - could you just say a word ot two
                >>>about the use of "this"?[/color]
                >>
                >>I think Mike Winter gets it mostly spot on here:
                >>
                >><URL:http://groups.google.c om/group/comp.lang.javas cript/browse_frm/thread/9b041b9103b6de0 f/2065870c97d74b5 0?tvc=1&q=How+t o+understand+th e+javascript+cl ass+model%3F&hl =en#2065870c97d 74b50>[/color]
                >
                >
                >
                > Thanks Rob - will follow up on this - by the way one of the longest
                > URL's I've seen![/color]


                Google groups links are long, but I think some references to MS
                developer documentation are longer ;-)
                [color=blue]
                >
                > How do you get the link to the posting?[/color]

                Enclose the link in <URL: > and your news reader does the rest.

                Incidentally, if you use '-- ' (that's dash dash space) on a line by
                itself before your signature, those who reply to your posts with a
                newsreader will have your signature automatically trimmed (which is
                thought to be a good thing in general).


                --
                Rob

                Comment

                Working...