• 利用回调函数实现的一个简单确认对话框。


    说明一下:如下采用IFRAME子调顶的方式进行对话框的获取(内页弹出提示请求,顶层窗体做统一弹出请求),因为仅做了技术上的实现,关于页面及详细代码如果需要请自行补脑。如果需要遮罩什么的处理也请自行补脑。

    另外如果对回调函数不理解请自行查阅相关文档。

    顶窗体:

    <html>
    <head>
    <title>Com.unisi.YPB</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script    src="jquery-1.8.3.min.js" type="text/javascript"></script>
    <script>
    $.extend($.fx,{message:{}})
    $.extend($.fx.message,
    {
        confirm:function(callBack){
            var call = new callBack();
            if ($("#fx-uc-dialog-confirm").length > 0) {
                $("#fx-uc-dialog-confirm").click(function(){
                    call.confirm();
                });
            }
            if ($("#fx-uc-dialog-cancel").length > 0) {
                $("#fx-uc-dialog-cancel").click(function(){
                    call.cancel();
                });
            }
            
        }
    })
    </script>
    </head>
    <body>
    <style>
    .dialogs{200px;background:#000;height:100px;}
    .dialogs span{background:#fff;color:#000;50px;height:20px;display:block;float:left;margin-left:10px;}
    </style>
    <div class="dialogs"><span id="fx-uc-dialog-confirm">是</span><span id="fx-uc-dialog-cancel">否</span></div>
    <iframe id="fx-frm" name="frm" src="b.html" width="1000px" height="500px" frameborder="1" scrolling="auto"></iframe>
    </body>
    </html>

    子窗体:

    <html>
    <head>
    <title>Com.unisi.YPB</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script    src="/com.unisi.client.core.ent.csm/component-script/libs-lib/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script>
    window.top.$.fx.message.confirm(deletePrompt);
    
    function deletePrompt() {
        this.confirm = function () {alert("选择了确认");}/*此部分如果需要自定义代码可以补充在这里面*/
        this.cancel = function () {alert("选择了取消");}
    }
    </script>
    </head>
    <body>
    </body>
    </html>
  • 相关阅读:
    超强视频分割/剪辑软件-Ultra Video Splitter绿色便携版
    超强视频分割/剪辑软件-Ultra Video Splitter绿色便携版
    ASP.NET做WEB开发的工具选择
    ASP.NET做WEB开发的工具选择
    C#中的局部类型
    OpenCV2:幼儿园篇 第四章 访问图像
    OpenCV2:幼儿园篇 第三章 导出图像
    OpenCV2:幼儿园篇 第二章 读取图像
    OpenCV2:幼儿园篇 第一章 创建图像并显示
    MFC隐藏在黑暗之中的大坑
  • 原文地址:https://www.cnblogs.com/fan-yuan/p/5079933.html
Copyright © 2020-2023  润新知