How to Open Form Submit in New Window?
I am currently using a form where there are 3 selections with radio buttons next to them. Depending on the radio button a person selects, when they submit the form they are then taken to a corresponding url. So there are 3 different urls they can be taken to depending on the selection they make before submitting the form.
The problem I am having is getting those urls they are taken to upon submitting the form, to open up in a NEW browser window. At the moment they are just forwarded to that url in the same window but that's not what I want.
Any ideas how to make this work. Here is the current code I am using.
Note: I have already tried adding the target="_blank" to the form action line but that does not work.
<script type="text/javascript">
function doSubmit(form) {
var urls = form['url'];
var i = urls && urls.length;
while (i--) {
if (urls[i].checked) {
window.location = urls[i].value;
}
}
return false;
}
</script>
</body> <form action="#" onsubmit="return doSubmit(this)"> <input type="radio" name="url" class="styled" checked="checked" value="http://google.com/option1" /><br /> <input type="radio" name="url" class="styled" value="http://google.com/option2" /><br /> <input type="radio" name="url" class="styled" value="http://google.com/option3" /><br /> <input name="" type="submit" class="button2" value="Select" /> </form>
Generate thousands of leads in any niche in under 60 seconds!