l111/afhankelijkeforms.php

<!DOCTYPE html> <html lang="en"> <head> <style> .veld{ width:150px; display:inline-block; text-align: left; } </style> <script> window.onload = check; function check(){ if(document.getElementById('buitenland').checked){ //document.getElementById('land2').disabled = false document.getElementById('land').style.display ='block' } else{ //document.getElementById('land2').disabled = true document.getElementById('land').style.display ='none' } } </script> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <form method="get"> <div><span class="veld">Naam : </span><input type='text' id="naam"></div> <div><span class="veld">Geboorteplaats :</span><input type='text' id="geboorteplaats"></div> <div><span class="veld"></span> <input type="checkbox" value="1" id="buitenland" onchange="check()"><label for="bank1">Ik woon in het buitenland</label></div> <div id="land"><span class="veld">Land :</span><input type='text' id="land2"></div> <div><span class="veld">Geboortedatum : </span><input type='date' id="geboortedatum"></div> </form> </body> </html>

Resultaat

Made by Thijs Aarnoudse