There is a form with input
<form method="post" action="bla.php" class="x_order_form" onsubmit="yaCounter38229915.reachGoal('order3'); return true;"> <input class="x_client_name" type="text" name="name" placeholder="Александр" required> <input class="x_client_phone" type="tel" name="phone" placeholder="+7 (___) ___-__-__" required> <button type="submit">Подтвердить</button> </form> I need to click on the button in the current window to open a new page, and in the new window there would be the result of the onsubmit of the form itself. Focus should go to a new window with the result of the form.
<script type="text/javascript"> var forms = document.getElementsByTagName('form'); for (var i in forms) { forms[i].setAttribute('target', '_blank'); forms[i].onsubmit = function() { window.location.href = 'http://yandex.ru'; } } </script> This script opens the result of the form in a new window, but does not load the new url in the current one. Tell me what's wrong?