chrisfozz 0 Newbie Poster

The code below was originally posted by langsor in 2008, I’ve adapted it to pass JavaScript values to a new page. I’d like the link to open the page in a new window, tab or iframe. I believe the code for a new window involves something to do with “target=_blank” but I don’t know how to use it in this context.
Any help would be greatly appreciated.

<head>
<script type="text/javascript">
window.onload = function () {
  var input = document.getElementById('name');
  var link = document.getElementById('link');
  input.onchange = function () {
    link.setAttribute( 'href', 'test1.php?name=' + this.value );
  };
};
</script>
</head>
<body>
  <input id="name" type="text" name="name" />
  <a id="link" href="#">Click Me</a>
</body>