Question

I am trying to use a Coldfusion javascript function to create a cfwindow and center it. I've followed documentation/tutorials to a T and I've tried this in CF8 and CF9 but I can't get it to center. What am I doing wrong?

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

Thanks :)

Was it helpful?

Solution

Use the function below to create a CfWindow. Call function create_Window() in <a> tag.

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;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top