main.html
------------------------------------------------------------
<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<title>
title
</title>
<script>
function show(url) {
  window.open (url, '', 'height=400, width=300, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=yes') //这句要写成一行 
}
</script>
</head>
<body bgcolor="#ffffff">
<form method="post" name="form">
<br><br>
  <input type="text" name="input" />
  <button name="button" onclick="javascript:show('new.html')">click me
  </button>
</form>
</body>
</html>

解决方案 »

  1.   

    new.html
    ----------------------------------------------------------------
    <%@ page contentType="text/html; charset=GBK" %>
    <html>
    <head>
    <script>
    function ToSelect(str) {
        window.opener.form.input.value=str;
        window.close(); //关闭本窗口
    }
    </script>
    </head>
    <body bgcolor="#ffffff">
    <form method="post" name="form">
    <button onclick="javascript:ToSelect('1');">1
    </button>
    <button onclick="javascript:ToSelect('2');">2
    </button>
    <button onclick="javascript:ToSelect('3');">3
    </button></form>
    </body>
    </html>