Jquery UI对话框表单在嵌入的表单中关闭

时间:2011-06-23 01:48:26

标签: javascript jquery user-interface dialog

我使用了类似的东西 jQuery UI Dialog window loaded within AJAX style jQuery UI Tabs

即..

<?xml version="1.0" encoding="iso-8859-1"?>
<html>
    <head>    
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
        <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css" type="text/css" />    
        <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"></script>
    </head>
    <body>    
         <a class="ajax" href="http://www.google.com"></a>
         <script type="text/javascript">    
             $(function (){        
                 $('a.ajax').click(function() {            
                     var url = this.href;            
                     var dialog = $('<div style="display:hidden"></div>').appendTo('body');            
                     // load remote content            
                     dialog.load(                
                         url,                 
                         {},                
                         function (responseText, textStatus, XMLHttpRequest) {                     
                             dialog.dialog();                
                         });            
                    //prevent the browser to follow the link            
                    return false;        
                });    
            });    
        </script>
    </body>
</html>

但是我需要在嵌入的表单中有一个取消按钮(谷歌在上面但在同一个域内)。当它调用JavaScript($ this).dialog(“close”)时,此取消按钮会在新的白页上返回“对象对象”。我尝试过这种变体,但是如果没有重新加载就无法获得原始的调用页面。

可以吗?怎么样?

0 个答案:

没有答案