Display button when checkbox checked?

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

    #1

    Display button when checkbox checked?

    I have a form in which I want to have an button(image) displayed next to a
    checkbox when it is checked.
    If the box is unchecked, the button should disappear.

    How can I do this?

    Thanks!



  • HikksNotAtHome

    #2
    Re: Display button when checkbox checked?

    In article <AHrKb.58$Zj6.1 7@fe01.usenetse rver.com>, "Targa"
    <targa1SPAMSUCK S@alltel.net> writes:
    [color=blue]
    >I have a form in which I want to have an button(image) displayed next to a
    >checkbox when it is checked.
    >If the box is unchecked, the button should disappear.
    >
    >How can I do this?
    >
    >Thanks![/color]

    Put a transparent gif there and then use a simple image swap.
    --
    Randy

    Comment

    • McKirahan

      #3
      Re: Display button when checkbox checked?

      "Targa" <targa1SPAMSUCK S@alltel.net> wrote in message
      news:AHrKb.58$Z j6.17@fe01.usen etserver.com...[color=blue]
      > I have a form in which I want to have an button(image) displayed next to a
      > checkbox when it is checked.
      > If the box is unchecked, the button should disappear.
      >
      > How can I do this?
      >
      > Thanks![/color]


      Perhaps?


      <html>
      <head>
      <title>button.h tm</title>
      <script language="javas cript" type="text/javascript">
      <!--
      function checker(that) {
      if (that.checked) {
      toggle.style.di splay = "";
      } else {
      toggle.style.di splay = "none";
      }
      }
      // -->
      </script>
      </head>
      <body>
      <form>
      <input type="checkbox" name="Box" onclick="checke r(this)">
      <span id="toggle" style="display: none">
      <input type="button" value="Button">
      </span>
      </form>
      </body>
      </html>


      Comment

      • Targa

        #4
        Re: Display button when checkbox checked?

        Hey - This works great!

        However, I have several fields below the initial checkbox and button. Anyway
        to leave those alone?

        Thanks!

        "McKirahan" <News@McKirahan .com> wrote in message
        news:AOsKb.2345 67$8y1.1054172@ attbi_s52...[color=blue]
        > "Targa" <targa1SPAMSUCK S@alltel.net> wrote in message
        > news:AHrKb.58$Z j6.17@fe01.usen etserver.com...[color=green]
        > > I have a form in which I want to have an button(image) displayed next to[/color][/color]
        a[color=blue][color=green]
        > > checkbox when it is checked.
        > > If the box is unchecked, the button should disappear.
        > >
        > > How can I do this?
        > >
        > > Thanks![/color]
        >
        >
        > Perhaps?
        >
        >
        > <html>
        > <head>
        > <title>button.h tm</title>
        > <script language="javas cript" type="text/javascript">
        > <!--
        > function checker(that) {
        > if (that.checked) {
        > toggle.style.di splay = "";
        > } else {
        > toggle.style.di splay = "none";
        > }
        > }
        > // -->
        > </script>
        > </head>
        > <body>
        > <form>
        > <input type="checkbox" name="Box" onclick="checke r(this)">
        > <span id="toggle" style="display: none">
        > <input type="button" value="Button">
        > </span>
        > </form>
        > </body>
        > </html>
        >
        >[/color]



        Comment

        • McKirahan

          #5
          Re: Display button when checkbox checked?

          "Targa" <targa1SPAMSUCK S@alltel.net> wrote in message
          news:ketKb.72$Z j6.40@fe01.usen etserver.com...[color=blue]
          > Hey - This works great!
          >
          > However, I have several fields below the initial checkbox and button.[/color]
          Anyway[color=blue]
          > to leave those alone?
          >
          > Thanks![/color]

          Just put
          onclick="checke r(this)"
          on the checkbox(es) you want.

          Or are you asking about the movement of those items when the button appears?
          If so, then try:

          <html>
          <head>
          <title>buttton. htm</title>
          <script language="javas cript" type="text/javascript">
          <!--
          function checker(that) {
          if (that.checked) {
          toggle.style.vi sibility = "visible";
          } else {
          toggle.style.vi sibility = "hidden";
          }
          }
          // -->
          </script>
          </head>
          <body>
          <form>
          <input type="checkbox" name="Box" onclick="checke r(this)">
          <span id="toggle" style="visibili ty:hidden">
          <input type="button" value="Button">
          </span>
          <br><input type="checkbox" name="Box" onclick="checke r(this)">
          </form>
          </body>
          </html>


          Comment

          Working...