I have defined text fields as follows:
<form name="form1" method="post" action="save_banners.php" onsubmit="return check_form();">
<input type=text name=banner[]>
<input type=text name=banner[]>
<input type=text name=banner[]>
<input type=text name=banner[]>
<input type=submit value="submit">
<script>
function check_form(){
alert (document.form1.banner[0].value);
}
</script>
How to access these fields in JavaScript? I am using the above JavaScript code, but it’s not working.
Regards,
Use the getElementsByName function: