Toggle navigation
Genres
Frontend (2)
JavaScript (6)
Database (2)
Linux Server (3)
Web Apps (4)
Misc (4)
Search
List
New Tutorials
Last Modified Tutorials
</>
Code examples
code
smiko
frontend
html
examples
forms
41passvars_js_newwindow.html
41passvars_js_newwindow.html
<!DOCTYPE HTML> <html lang="hr"> <head> <meta charset="UTF-8"> <title>JS open form values in new window</title> <script><!-- function ispis(){ prozor=window.open("","","toolbar=0,location=1,left=0,top=0,screenX=0,screenY=0"); prozor.resizeTo(600,400); //car name var naziv=document.forms[0].naziv.value; //color for (i=0; i<document.forms[0].boja.length; i++){ if (document.forms[0].boja[i].checked==true){ var color=document.forms[0].boja[i].value; var i=document.forms[0].boja.length; } else { var color="Not choosen !!!"; } } prozor.document.write("You enter car: <b>",naziv ,"</b>"); prozor.document.write("<br>It's color is: <b>",color ,"</b>"); } --></script> </head> <body> <form action="javascript:ispis()" method="POST"> Car type: <input type="Text" name="naziv" size="50"> <br> <br> Car color <input type="radio" name="boja" value="blue">bluish <input type="radio" name="boja" value="green">greeny <input type="radio" name="boja" value="red">redy <br> <br> <input type="submit" value="Open in new window"> <input type="reset" value="Reset the form"> </form> </body> </html>
Reload page
Preview
W3C validation
Edit Code