我有2个月的这个例子,我改变了PC。现在这似乎不再起作用了。这是一个应该通过(按下)按钮加载小窗口对话框的示例。 但是,它不起作用...... 这是我的代码:
<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>
请..为什么我的对话框出现错误???
答案 0 :(得分: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...
}
答案 1 :(得分:2)
我遇到了同样的问题。我在同一个网页上包含了jQuery两次(jQuery然后是jQuery UI然后是jQuery,它会给我带来麻烦(.dialog上完全相同的问题)
答案 2 :(得分: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>