Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Jquery UI对话框关闭按钮不工作_Javascript_Jquery_Html_Jquery Ui - Fatal编程技术网

Javascript Jquery UI对话框关闭按钮不工作

Javascript Jquery UI对话框关闭按钮不工作,javascript,jquery,html,jquery-ui,Javascript,Jquery,Html,Jquery Ui,我使用了jQueryUI对话框,如下图所示 当我点击打印按钮时,对话框内的div内容将被打印 打印功能代码 function printDiv() { var originalContents = document.body.innerHTML; var printContents = document.getElementById('PrintDivcontent').innerHTML; document.body.innerHTML = "<html>

我使用了jQueryUI对话框,如下图所示

当我点击打印按钮时,对话框内的div内容将被打印

打印功能代码

function printDiv() {
    var originalContents = document.body.innerHTML; 
    var printContents = document.getElementById('PrintDivcontent').innerHTML;
    document.body.innerHTML = "<html><head><title></title></head><body style='background-color:#FFFFFF;'>"
            + printContents + "</body>";
    window.print(); 
    document.body.innerHTML = originalContents;
}
有什么办法吗? 请帮帮我

更新

HTML代码

<div id="ReportPopup">
            <div id="PrintDivcontent">

                <div id="ReportTablecontainer">
                    <table id="ReportTable"><tbody><tr><th>Time</th><th>Action</th><th>comment</th></tr><tr class=""><td style="text-align:center;width:25%">2014-06-05 13:50:03</td><td style="padding-left:5px;width:50%">cdfsdfsd</td><td style="text-align:center;width:25%"></td></tr><tr class="altRow"><td style="text-align:center;width:25%">2014-06-05 13:51:58</td><td style="padding-left:5px;width:50%">fsdfsd</td><td style="text-align:center;width:25%">dsfsd</td></tr><tr class=""><td style="text-align:center;width:25%">2014-06-05 13:52:01</td><td style="padding-left:5px;width:50%">dfsdfs</td><td style="text-align:center;width:25%">sfsdfs</td></tr><tr class="altRow"><td style="text-align:center;width:25%">2014-06-05 14:25:45</td><td style="padding-left:5px;width:50%">dsfsdfs</td><td style="text-align:center;width:25%">sdfsdfsd</td></tr><tr class=""><td style="text-align:center;width:25%">2014-06-05 14:42:10</td><td style="padding-left:5px;width:50%">sdfsdfsd</td><td style="text-align:center;width:25%">sdfsdfsd</td></tr></tbody></table>
                </div>
            </div>
            <div class="reportButtonContainer">

                <input type="button" onclick="printDiv()"  value="PRINT">
            </div>
        </div>

我更改了打印功能的代码

function printDiv() {  
      var divContents = $("#PrintDivcontent").html();
        var printWindow = window.open('', '', 'height=600,width=800');
        printWindow.document
                .write('<html><head><title>Title of Print Page</title>');
        printWindow.document.write('</head><body >');
        printWindow.document.write(divContents);

        printWindow.document.close();
        printWindow.print();
        printWindow.close();

    }
现在它工作得很好。

您好,您能提供与之相关的HTML代码吗?这样我就可以完成小提琴了。谢谢Siddle关机请稍等一会儿请在Fiddle中发布演示嗨,我已经检查了它的工作状态,请检查链接@subkriti不适合我…嗨,你能再次检查演示链接吗,我想现在Windows的打印对话框没有启动。
$("#ReportPopup").dialog({
            modal:true,
            resizable: false,
            title: 'Report',           
            show:  {
                effect      : 'fold'
            },
            hide:{
                effect : 'fold'
            },
            width: 650,
            height: 600 ,
            minHeight:"auto"
        });
function printDiv() {  
      var divContents = $("#PrintDivcontent").html();
        var printWindow = window.open('', '', 'height=600,width=800');
        printWindow.document
                .write('<html><head><title>Title of Print Page</title>');
        printWindow.document.write('</head><body >');
        printWindow.document.write(divContents);

        printWindow.document.close();
        printWindow.print();
        printWindow.close();

    }