两个文件,test.htm 和 lizi.htm
++++===================  test.htm =========
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<form name="form1" method="post" action="">
  <p>
    <select name="select" onchange="window.open('lizi.htm')">
      <option>1</option>
      <option>2</option>
    </select>
  </p>
  <p>
    <input type="text" name="textfield">
  </p>
</form>
<script>
var str=document.location.search
var str2=str.split("=")
document.form1.textfield.value=str2[1];
</script>
</body>
</html>========== lizi.htm ===========
<html>
<head>
<title>无标题文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script>
function test(){
opener.location.href=opener.location+"?form1="+document.form1.textfield.value
opener.location.reload()
self.close()
}
</script>
</head><body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="">
  <input type="text" name="textfield">
  <br>
  <input type="submit" name="Submit" value="提交" onclick="test()">
</form>
</body>
</html> 

解决方案 »

  1.   

    对于test.htm文件打开时,文本框出现的undefined,可以采用下面的办法解决
    test.htm
    ===========
    <script>
    var str=document.location.search
    if(str) {
    var str2=str.split("=")
    document.form1.textfield.value=str2[1];
    }
    </script>   
      

  2.   

    其实这个问题很简单,
    我总算相同了
    多谢net_lover(孟子E章)的提示。
    我现在这样解决
    <script>
    function s(x)
    {
    opener.'||vElement||'.value = x
    self.close()
    opener.focus
    }
    </script>
    v_postUrl为opener中的对象名字。
    我用的是Oracle中plSql过程。动态生成javascript过程。
    分只能给你了。
      

  3.   

    但是我的opener如果关闭,或者导航到其他页面的话,会报错。
    请问如何忽略
    我在书上也看了例子,但说我语句有错。
      

  4.   

    可以先判断opener是否存在啊!!
      

  5.   

    if(opener||opener.open||!opener.closed) 窗口存在