关闭基于结果的弹出窗口

2024-10-02 18:19:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图打开一个窗口,从一个点击后,在url的响应,其中包括一个确认页,如果是成功的,它将关闭窗口。你知道吗

我用这个打开窗户:

        url = 'http:/mywebsite/index';
        width = 545;
        height = 433;
        var leftPosition, topPosition;
        //Allow for borders.
        leftPosition = (window.screen.width / 2) - ((width / 2) + 10);
        //Allow for title and status bars.
        topPosition = (window.screen.height / 2) - ((height / 2) + 50);
        //Open the window.
        window.open(url, "Window2", "status=no,height=" + height + ",width=" + width + ",resizable=yes,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");

返回的URL http:/mywebsite/index是一个json转储,其中包含一个成功字典(true或false)。我用python编写代码

我遇到的问题是如何在python返回时关闭窗口。你知道吗

我尝试返回一个由window.close()组成的HTML和javascript字符串。但运气不好。如果我做错了什么,请告诉我应该怎么做。你知道吗

谢谢。你知道吗


Tags: nohttpurlforindexstatuswindowwidth
1条回答
网友
1楼 · 发布于 2024-10-02 18:19:20

您需要存储窗口打开并对该对象调用close():

你知道吗 var mywindow

我的窗口=打开新窗口(…)

。。。你知道吗

你知道吗我的窗口。关闭()

相关问题 更多 >