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
44passvars_js_select_multiple.html
44passvars_js_select_multiple.html
<!DOCTYPE HTML> <html lang="hr"> <head> <meta charset="UTF-8"> <title>Multiple select is array - JS</title> <script><!-- function ispis(){ prozor=window.open("","","toolbar=0,location=1,left=0,top=0,screenX=0,screenY=0"); prozor.resizeTo(600,400); for (var i=0; i<document.forms[0].naselje.length; i++){ if (document.forms[0].naselje[i].selected==true){ var mjesto=document.forms[0].naselje[i].value; prozor.document.write("<br>You select: <b>"+mjesto+"</b>"); } } } --></script> </head> <body> Hold CTRL or SHIFT when selecting multiple items. <br> <form action="javascript:ispis()" method="POST" enctype="application/x-www-form-urlencoded"> <select name="naselje" size="6" multiple> <option value="NAŠICE">Našice</option> <option value="VALPOVO">Valpovo</option> <option value="OSIJEK">Osijek</option> <option value="ĐAKOVO">Đakovo</option> </select> <br> <br> <input type="submit" value="Open filename in new window"> <input type="reset" value="Reset the form"> </form> </body> </html>
Reload page
Preview
W3C validation
Edit Code