Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
动态加载的Jquery对话框不会在单击按钮时关闭_Jquery_Html_Asp.net_Jquery Ui - Fatal编程技术网

动态加载的Jquery对话框不会在单击按钮时关闭

动态加载的Jquery对话框不会在单击按钮时关闭,jquery,html,asp.net,jquery-ui,Jquery,Html,Asp.net,Jquery Ui,我的呼叫页面如下: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="WebApplication2.WebForm3" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <script typ

我的呼叫页面如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="WebApplication2.WebForm3" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
   <script type="text/javascript" src="Scripts/jquery-1.7.1.js"></script>
    <script type="text/javascript" src="Scripts/jquery-ui-1.8.17.js"></script>
    <style type="text/css">
        .ui-dialog
        {
            position: fixed;
            overflow: hidden;
        }

        .ui-widget-overlay
        {
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            position: absolute;
            background: #aaaaaa;
            opacity: .3;
            filter: Alpha(Opacity=30) /*{opacityOverlay}*/;
        }
    </style>
    <script type='text/javascript'>
        function Load() {
            var sURL = "webForm4.aspx";
            $('<div id="dialogDiv"></div>').hide().load(sURL, function () {
                $(this).dialog({
                    resizable: false,
                    height: "auto",
                    width: 500,
                    position: "center",
                    modal: true,
                    showClose: false,
                    closeOnEscape: false,
                    autoOpen: true,
                    draggable: true,
                    title: "<b>Notification Policy</b>",
                    create: function (event, ui) {
                        $(".ui-dialog-titlebar-close").hide();
                    },
                    close: function () {
                        $('#dialogDiv').remove();
                    }
                });
            });
        }
    </script>
</head>
<body>
    <form id="form1">
    <input type="button" value="load" id="btn" onclick="Load();"/>
    </form>
</body>
</html>
在这种情况下,我的动态加载页面WebForm4.aspx如下所示:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="WebApplication2.WebForm4" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script language="javascript" type="text/javascript">

        function bindEvent() {
            var text = $('#inittext').val();
            if (text.length < 3) {
                alert("Enter atleast 3 characters");
            }
            else {
                $('#dialogDiv').dialog('close');
            }
        }


    </script>
</head>
<body>
    <div id="content">
        <table width="100%">
            <tr>
                <td align="center">Acknowledgement (Enter Initials):
                    <input id="inittext" type="text" value="" style="width: 40px;" maxlength="3" />
                    <input id="btnContinue" type="button" value="done" style="width: 40px;" onclick="bindEvent();"/>
                </td>
            </tr>
        </table>
    </div>
</body>
</html>
我想通过单击上面代码中生成的“完成”按钮来关闭对话框,但问题是“完成”按钮单击事件从未触发。有人能帮我吗

webform4.aspx中还有一个html文本框。如何在调用页中获取该文本框的值

注意->我可以更改webForm4.aspx的内容,因此这是必要的 该对话框可以通过webForm4.aspx上的按钮关闭 试试这个

使用$this.dialog'close';而是$this.dialogclose


我应该在哪里添加呢?但是问题是这个绑定事件根本没有被调用!!!你能看一看我在编辑后放在上面的代码吗?看你犯了一些愚蠢的错误,这里没有讨论,你应该自己做。你不必以分号结尾。onclick=bindEvent和onclick=bindEvent;两者都很好用。或者试试onclick=javascript:bindEvent社区中没有人能帮助我吗?
function bindEvent() {
        var text = $('#inittext').val();
        if (text.length < 3) {
            alert("Enter atleast 3 characters");
        }
        else {
            $(this).dialog('close');
        }
    }