把var去掉试试.
onclick="childWin=window.open('process.htm','','width=250,height=40')">
要不就写个函数,childWin必须是全局变量。

解决方案 »

  1.   

    哦,还有你的doevent.php和打开窗口的不是同一个页面吗?
    它们的关系如何?
      

  2.   

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    childWin=window.open('process.htm','','width=250,height=40')">
    childWin.close();
    //-->
    </SCRIPT>
      

  3.   

    doevent.php和打开的窗口不是一个页面请问,去掉var也报一样的错啊
      

  4.   

    因为页面提交跳转,childWin句柄在新页中不再有效,建议你用隐藏帧的方式,提交后将原页面藏起来,使窗口句柄继续有效。参考
    <frameset name=myfrmset cols="*,1005">
    <frame name=hide src=target.htm>
    <frame name=show src=submit.htm>
    </frameset>target.htm//将这个换为你的php页
    <input type=button onclick=top.show.childWin.close()>submit.htm
    <script>
    var childWin;
    function myopen()
    {
    childWin=window.open('process.htm','','width=250,height=40,status=yes');
    top.myfrmset.cols="100%,*";
    }
    </script>
    <form action="target.htm" target=hide>
    <input type="submit" value="提交" name="submit" onclick="myopen()">
    <input type=button onclick=childWin.close()>
    </form>
      

  5.   

    liuliu26(小雨):
    这样的话是没错,但达不到我的要求,我需要将这两个动作分开做,谁知道怎么办。
    我对javascript中的全局变量如何定义感到模糊