Thorsten F.: Checkbox: beim Click show ansonsten hide

Beitrag lesen

Ups,
so habs. Thread nicht angucken. Augenkrebsgefahr........

funzen tut es so:

<html>
<head>
  <title>
   Checkbox
  </title>

<script type="text/javascript">
   function show(fieldname)
   {
    alert(fieldname);
    if(document.formular.boxone.checked)
    {
     document.getElementById(fieldname).style.visibility = "visible";
    }
    else
     document.getElementById(fieldname).style.visibility = "hidden";
   }
  </script>
</head>

<body>
  <form name="formular" action="">
   <table border="1">
    <tr>
     <td>
      <input type="checkbox" name="boxone" onClick="show('fieldone');">Click me
     </td>
     <td>
      <input type="text" name="fieldone" style="visibility:hidden" value="Ihre Eingabe">
     </td>
    </tr>
   </table>
  </form>
</body>
</html>