A.html 如下<div id="test" title="<?php echo $text_quote_open_window_title; ?>" style="top: 10px;
        padding: 1px; width: 780px; height: 590px; display: none;">
    </div>js 如下
  $("#test").window({
               width: 780,
               modal: true,
               height: 590,
               href: 'B.html'
              });问题,a.html 使用window 加载一个b.html ,然后加载的b.html 这个窗口 有个关闭按钮,希望在点击按钮的时候关闭,可是怎么也关不掉,
按照easyui 的 window 写法应该是
$('#test').window('close');可是这只是针对于一个界面的window 弹出层才可以,加载另外一个界面如何关闭子页面?
dialog 也是一样的问题关不掉子窗口,求解答。

解决方案 »

  1.   

    parent.document.getElecmentById("#test").window('close');
      

  2.   

    没问题啊。。<!DOCTYPE html>
    <html style="width:100%;height:100%;overflow:hidden">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Window - jQuery EasyUI Demo</title>
    <link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../themes/icon.css">
    <link rel="stylesheet" type="text/css" href="demo.css">
    <script type="text/javascript" src="../jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="../jquery.easyui.min.js"></script>
    <script>
        $(function () {
            $("#test").window({
                width: 780,
                modal: true,
                height: 590,
                href: 'B.html'
            });
        });
    </script>
    </head>
    <body>
    <div id="test" title="abc" style="top: 10px;
            padding: 1px; width: 780px; height: 590px;">
        </div></body>
    </html>
    b.html
    b.html<input type="button" value="close" onclick="$('#test').window('close')"/>
      

  3.   

     parent.document.getElementById("test").window("close");
    试过了不行,在A.html写
    function testclose(){
    $('#test').window('close');} 涵数,然后在弹出的b.htm 用top.testclose()涵数也不行
      

  4.   


    谢谢版主,是可以,是我太大意了,我在子页面里面有也引有
        <script type="text/javascript" src="../jquery.easyui.min.js"></script>
    这个JS,所以就不能正常关闭,看样子只能在子页面里面不能引用这个JS了
      

  5.   

    上面发错了是因为在子页面引用了
    <script type="text/javascript" src="../jquery-1.4.4.min.js"></script>
    a.htm如果引用了,b.htm再引用就不能正常关闭了
      

  6.   


    因为加载b.html是通过ajax,不是iframe,jq 的ajax加载页面有script会动态装载script加载的js代码,你放了jq在里面导致重新加载js覆盖了easyui的扩展导致找不到easyui了。在csdn碰到蛮多这个问题的,呵呵。。加载的页面不要在放jq类库