打开一个新页面作为模式窗口

Open a new page as modal window

本文关键字:新页面 模式 窗口 一个      更新时间:2023-09-26

我有以下代码,如果行存在,如何打开另一个页面作为模态窗口弹出窗口?

 function editLesson(){
            var row = $('#dg').datagrid('getSelected');
            if (row){
             // would like to open another page as modal window
            }
        }

任何帮助都是非常可观的。

你可以使用fancybox插件。 这是一个非常棒的插件。http://fancybox.net/(心灵花式盒子2也出来了)

http://jsfiddle.net/kasperfish/5EV8r/109/

$.fancybox('hello');

您还可以在花式框(模态)窗口中加载iframe。http://jsfiddle.net/kasperfish/5EV8r/110/

    $.fancybox([
        'url'//url to your page
    ], {
        'padding'           : 10,
        'type'              : 'iframe',//set type to iframe
        'overlayOpacity'    : 0.7,
        'overlayColor'      : 'black',
        'speedIn'           : 900,
        'speedOut'          : 400,
        'width'             : '70%',
        'height'            : '50%'
    });

您可以使用 JQuery 对话框

如下所述:

   <!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>jQuery UI Dialog - Default functionality</title>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />
  <script>
  $(function() {
    $( "#dialog" ).dialog();
  });
  </script>
</head>
<body>
<div id="dialog" title="Basic dialog">
  <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>

</body>
</html>

http://jqueryui.com/dialog/