2

我有一个 javascript 函数 graph() ,它绘制了一个动态图,我想把它放在一个模态对话框中。我写了这个:

function drawGraphinDialog(){
    $("body").append('<div id="graphdialog"></div>');
    $(document).ready(function(){
         $("#graphdialog").dialog({
                    modal: true,
                    open: function{
                                      graph();
                                 },        
                    height: 600,
                    width: 400,
                    title: 'This is your graph'
                    });
        return false;
    });
}  

但模态对话框是空的。我应该把函数 graph() 放在哪里才能正确地在图中绘制它?谢谢您的帮助!

编辑:该图是用这个库制作的http://www.graphdracula.net/ ...所以如果我在 html 正文页面中调用这个函数 graph() 它会绘制这个图,我实际上可以看到它。

4

1 回答 1

0
function drawGraphinDialog(){
    $("body").append('<div id="graphdialog"></div>');
    call graph() function and set its content to graphdialog div
    $("#graphdialog").html(graph_content)

$('#graphdialog').dialog({
        modal: true,
        height: 600,
                    width: 400,
                    title: 'This is your graph'
    });
}  
于 2012-06-14T08:35:41.000 回答