<!DOCTYPE html "about:legacy-compat"> <html lang="pl"> <head> <meta charset="UTF-8"/> <script type="text/javascript"> var pole = document.getElementById('formularz').poleTekstowe.value; document.write("Tekst " + pole + " pochodzi z pola formularza"); document.write("Czy jestem pewien ze " + pole + " pochodzi z formularza?"); document.write(pole + " - wszystko wskazuje że tak jest"); </script> </head> <body> <form method="get" action="?" name="formularz"> <input type="submit" id="sub" value="ok"/> </form> </body> </html>
Według rozdziału http://kursjs.pl/kurs/zmienne.html jednak nie wiem czy zrozumiałem.
Dodałem document.write('test'); nad tamtym skryptem i wyświetla test ale nic wiecej, nawet po wysłaniu formularza.