6

我有两个月的这个例子,我换了电脑。现在这似乎不再起作用了。这是一个应该通过(之前)按下按钮来加载小窗口对话框的示例。但是,它不起作用......这是我的代码:

<html>
<head>
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
  <script type="text/javascript">
// <---- VENTAÑAS DE PARAMETERES---->

var regex,v,l,c,b;
$( "#wnd_Addparam" ).dialog({
            autoOpen: false,
            height: 'auto',
            width: 350,
            modal: true,
            resizable:false,
            buttons: {
                "Add": function() {
                                $( this ).dialog( "close" ); 
                                   },
                Cancel: function() {
                    $( this ).dialog( "close" );
                }
            },
            close: function() {
                $( this ).dialog( "close" );
            }
        });

        $( "#btn_Addpar" ).click(function() {
                $( "#wnd_Addparam" ).dialog( "open" );
            });
$( "#wnd_Paramedit" ).dialog({
            autoOpen: false,
            height: 'auto',
            width: 350,
            modal: true,
            resizable:false,
            buttons: {
                "Accept": function() {
                      $( this ).dialog( "close" );  

                },
                Cancel: function() {
                    $( this ).dialog( "close" );
                }
            },
            close: function() {
                $( this ).dialog( "close" );
            }
        });

        $( "#btn_Pedit" ).click(function() {
                $( "#wnd_Paramedit" ).dialog( "open" );
            });
$( "#wnd_Borpara" ).dialog({
            autoOpen: false,
            height: 'auto',
            width: 300,
            resizable:false,
            modal: true,
            buttons: {
                "Accept": function() {
                    $(this).dialog("close");

                },
                Cancel: function() {
                    $( this ).dialog( "close" );
                }
            },
            close: function() {
                $( this ).dialog( "close" );
            }
        });

        $( "#btn_Deletepara" ).click(function() {
                $( "#wnd_Borpara" ).dialog( "open" );
            });

</script></head>
<!--<form method="POST" id="iformp" name="nformp">-->
<body>
<h3>List of parameters</h3>
<div id="sortparam" >
</div>
 <input type="button" id="btn_Addpar" value="Add"/>
<input type="button" id="btn_Deletepara" value="Delete"/>
<input type="button" id="btn_Pedit" value="Edit"/>
<!--<form>-->

</body>

</html>

请..为什么我的对话框有错误???

4

3 回答 3

4

您引用的是 jQuery 核心,而不是 jQuery UI 本身。

我相信该dialog功能仅存在于 jQuery UI 中,因此您还需要将以下内容添加到您的页面中:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script>

<script type="text/javascript">
// <---- VENTAÑAS DE PARAMETERES---->
$(document).ready( function () {
    var regex,v,l,c,b;
    $( "#wnd_Addparam" ).dialog({
        // Your code...
}
于 2012-10-16T08:10:28.263 回答
2

我有同样的问题。我在同一个网页上包含了 jQuery 两次(jQuery 然后是 jQuery UI 然后是 jQuery,这给我带来了麻烦(在 .dialog 上完全相同的问题)

于 2014-06-27T07:34:46.617 回答
1
Now use this code simple....


<html>
    <head>
     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script>
    <script type="text/javascript">
    // <---- VENTAÑAS DE PARAMETERES---->
    $(document).ready(function() { 
    var regex,v,l,c,b;
    $( "#wnd_Addparam" ).dialog({
                autoOpen: false,
                height: 'auto',
                width: 350,
                modal: true,
                resizable:false,
                buttons: {
                    "Add": function() {
                                   $( this ).dialog( "close" ); 
                                       },
                    Cancel: function() {
                        $( this ).dialog( "close" );
                    }
                },
                close: function() {
                    $( this ).dialog( "close" );
                }
            });

            $( "#btn_Addpar" ).click(function() {
                    $( "#wnd_Addparam" ).dialog( "open" );
                });

    });
    </script>
    </head>
    <!--<form method="POST" id="iformp" name="nformp">-->
    <body>
    <h3>List of parameters</h3>
    <div id="sortparam" >
    </div>
     <input type="button" id="btn_Addpar" value="Add"/>

    <!--<form>-->

    </body>

    </html>
于 2012-10-16T08:49:11.760 回答