Javascript生成的CFWindow不以Coldfusion为中心

时间:2011-02-18 19:21:54

标签: javascript coldfusion cfwindow

我正在尝试使用Coldfusion javascript函数来创建cfwindow并使其居中。我已经按照文档/教程进行了测试,我在CF8和CF9中尝试了这个,但我无法将其置于中心位置。我做错了什么?

<a href="javascript:ColdFusion.Window.create('createdWindow','Window Name',
'test.cfm',{modal: true, center: true});">Create Bound Window</a>

谢谢:)

1 个答案:

答案 0 :(得分:1)

使用以下功能创建CfWindow。在create_Window()代码中调用函数<a>

function create_Window() {
    win = name + "_os_" + Math.round(Math.random() * 10000000000);

    try
    {
        twin = ColdFusion.Window.getWindowObject(winname);
        twin.destroy(true);
    }
    catch (e)
    {
        // do nothing because the window does not exist
    }

    ColdFusion.Window.create(
        win,
        'Request Page',
        'windowPageName.cfm?windowname='+win,
        {
            height:600,
            width:700,
            modal:true,
            closable:true,
            draggable:true,
            resizable:true,
            center:true,
            initshow:true
        }
    )

    winname=win;
}