Javascript此对象不支持此操作

发布于 2024-12-28 06:17:44 字数 451 浏览 1 评论 0原文

错误:

“此对象不支持此操作”

目标是在单击页面中的按钮时关闭子窗口 子

窗口的按钮代码

button type="submit" onclick ="window.parent(dlgClose(dlg))"  

它调用 *.js

    function dlgClose(dlg) 
    {

        $("dlg").dialog("close");
        return false;
    } 

dgl 是该对象的 id “div”包含放置在母版页内“内容”中的“iframe”,我有一个父窗口,可以在 jquery 对话框中搜索和发布结果,进行更改,保存它,但我似乎无法关闭对话框。

The error:

"this object does not support this action"

The goal is to close a child window upon clicking on a button in a page

Button code of the child window

button type="submit" onclick ="window.parent(dlgClose(dlg))"  

It's calling the *.js

    function dlgClose(dlg) 
    {

        $("dlg").dialog("close");
        return false;
    } 

dgl is the id of the "div" that contains an "iframe" placed in a "content" within the master page, I have parent window that searches and posts the results in the jquery dialog, makes changes, saves it and I can't seem to close the dialog.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

兮颜 2025-01-04 06:17:44

为您更新代码

//对于对象

function dlgClose(dlg) {
    $(dlg).dialog("close");
    return false;
 }  

//或者如果它和id比

function dlgClose(dlg) {
    $('#'+dlg).dialog("close");
    return false;
 }  

Updated code for you

//for object

function dlgClose(dlg) {
    $(dlg).dialog("close");
    return false;
 }  

//or if its and id than

function dlgClose(dlg) {
    $('#'+dlg).dialog("close");
    return false;
 }  
无所的.畏惧 2025-01-04 06:17:44
onclick ="window.parent(dlgClose(dlg))" 

那个onclick是错误的,它调用的是当前窗口范围内的函数。

onclick ="window.parent.dlgClose('dlg')" 

这也假设 dlg 是正确的,不确定到底是什么。

onclick ="window.parent(dlgClose(dlg))" 

That onclick is wrong, it is calling the function in the current window scope.

onclick ="window.parent.dlgClose('dlg')" 

That also assumes dlg is correct, not sure what that is supposed to be exactly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文