I am working on contact page where the client can enter the postcode which will take them to google maps for directions to the company, the problem which i am having is although the hyperlink is set to target_blank but still the window opens on the back hand instead of opening in front of the website page. I have no idea why it opens on the back hand and focus is on the current page instead of moving it to google map page
<a href="#" target="_blank"> <img alt="" src="/images/contactUs/directionbtn.png" onclick="return openDirections(1);" /></a> <script type="text/javascript"> function openDirections(NumVal) { if (NumVal == 1) { if (document.getElementById("<%=txtPostcode.ClientID%>").value == "") { alert("PostCode can not be blank"); document.getElementById("<%=txtPostcode.ClientID%>").focus(); return false; } else { var regPostcode = /^([a-zA-Z]){1}([0-9][0-9]|[0-9]|[a-zA-Z][0-9][a-zA-Z]|[a-zA-Z][0-9][0-9]|[a-zA-Z][0-9]){1}([ ])([0-9][a-zA-z][a-zA-z]){1}$/; var tempURL = document.getElementById("<%=txtPostcode.ClientID%>").value; if (regPostcode.test(tempURL) == false) { alert("Please Enter a Valid PostCode"); document.getElementById("<%=txtPostcode.ClientID%>").focus(); return false; } else { var url = 'http://maps.google.co.uk/maps?saddr={' + $('#<%=txtPostcode.ClientID%>').val() + '}&daddr=&daddr=646+Preston+Rd,+Clayton-le-Woods,+Chorley+PR6+7EH,+United+Kingdom&iwloc=1&dq=Tangent+Design'; document.location = url; return true; } } } </script>