
po zaznaczeniu checkboxa pojawia sie pod nim napis "cos" (- to jest ok) ale obok niego nie wyświetla się pole do wpisywania danych
//czy może Ktoś wie co robie nie tak?
Probowałem zabawy z <div> ale tez jest zle..
Kod
<html>
<head>
<script type="text/javascript">
function showDiv(){
var checkBox = document.getElementById('a');
var oDiv = document.getElementById('b');
if(checkBox.checked == true){
oDiv.style.display = 'block';
}
else if(checkBox.checked == false){
oDiv.style.display = 'none';
}
}
</script>
</head>
<body>
<div id="top">
<div id="NAGLOWEK">naglowek</div>
<div id="FORM_REJ">
<h2> Wprowadz dane </h2>
<form action="form_rej.php" method="POST">
<table border="0">
<tr><td>imię</td><td> <input type="text" name="imie" maxlenght="30" size="30"></td></tr>
<tr><td>nazwisko</td><td> <input type="text" name="nazwisko" maxlenght="30" size="30"></td></tr>
<tr><td>login</td><td> <input type="text" name="login" maxlenght="30" size="30"></td></tr>
<tr><td>hasło</td><td> <input type="password" name="haslo" maxlenght="30" size="30"></td></tr>
<tr><td>powtórz hasło</td><td> <input type="password" name="haslo2" maxlenght="30" size="30"></td></tr>
<tr><td>email</td><td> <input type="text" name="email" maxlenght="30" size="30"></td></tr>
<tr><td><input type="checkbox" name="a" id="a" onClick="showDiv()"> firma </td><td></td></tr>
<tr><td><div id="b" style="display:none;">cos</div></td><td><div id="b" style="display:none;">vods</div> </td></tr>
<tr><td>regon</td><td> <input type="text" name="regon" maxlenght="30" size="30"></td></tr>
<tr><td colspan="2"> <input type="submit" value="dodaj" name="send">
</table>
</form>
</body>
</html>
<head>
<script type="text/javascript">
function showDiv(){
var checkBox = document.getElementById('a');
var oDiv = document.getElementById('b');
if(checkBox.checked == true){
oDiv.style.display = 'block';
}
else if(checkBox.checked == false){
oDiv.style.display = 'none';
}
}
</script>
</head>
<body>
<div id="top">
<div id="NAGLOWEK">naglowek</div>
<div id="FORM_REJ">
<h2> Wprowadz dane </h2>
<form action="form_rej.php" method="POST">
<table border="0">
<tr><td>imię</td><td> <input type="text" name="imie" maxlenght="30" size="30"></td></tr>
<tr><td>nazwisko</td><td> <input type="text" name="nazwisko" maxlenght="30" size="30"></td></tr>
<tr><td>login</td><td> <input type="text" name="login" maxlenght="30" size="30"></td></tr>
<tr><td>hasło</td><td> <input type="password" name="haslo" maxlenght="30" size="30"></td></tr>
<tr><td>powtórz hasło</td><td> <input type="password" name="haslo2" maxlenght="30" size="30"></td></tr>
<tr><td>email</td><td> <input type="text" name="email" maxlenght="30" size="30"></td></tr>
<tr><td><input type="checkbox" name="a" id="a" onClick="showDiv()"> firma </td><td></td></tr>
<tr><td><div id="b" style="display:none;">cos</div></td><td><div id="b" style="display:none;">vods</div> </td></tr>
<tr><td>regon</td><td> <input type="text" name="regon" maxlenght="30" size="30"></td></tr>
<tr><td colspan="2"> <input type="submit" value="dodaj" name="send">
</table>
</form>
</body>
</html>
dałem rade samemu
