就是我现在想要个Dialog,当点击了服务器端的Button之后,就弹出Dialog提示,然后执行 Button的click事件;
我现在的情况是 那个Dialog, 加载完成就弹出来了,然后点按钮的时候也能弹出来。————————
请各位大侠指点一下
————
或者给个完整的Demo
谢了先!
我现在的情况是 那个Dialog, 加载完成就弹出来了,然后点按钮的时候也能弹出来。————————
请各位大侠指点一下
————
或者给个完整的Demo
谢了先!
那就不要把弹Dialog的方法写在$(document).ready()里面
<html>
<head>
<title></title>
<link href="css/ui-lightness/jquery-ui-1.8.10.custom.css" rel="stylesheet" type="text/css" />
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.8.10.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
// $(function () {
// var dlg = $("#testDialog").dialog();
// dlg.parent().appendTo(jQuery("form:first")); //========================================
// $("#btn").click(function () {
// var dlg = $("#testDialog").dialog();
// dlg.parent().appendTo(jQuery("form:first"));
// });
// $(function () {
// $("#dialog").dialog({
// autoOpen: false,
// modal: true,
// buttons: {
// "Yes": function () {
// $(this).dialog("close");
//
// },
// "No": function () {
// $(this).dialog("close");
// },
// "Maybe": function () {
// $(this).dialog("close");
// //what should we do when "Maybe" is clicked?
// }
// }
// });
// });
// });
//
// function showDialog() {
// $("#dialog").dialog("open");
// }; //===========================在ready时就弹出了============
/* $(function () {
var dlg = $("#testDialog").dialog();
dlg.parent().appendTo(jQuery("form:first"));
});
*/
//======================ready时弹出,点击的时候也弹出==========
/* $(function showDialog() {
var dlg = $("#testDialog").dialog();
dlg.parent().appendTo(jQuery("form:first"));
});
*/
//===========================
function showDialog() {
var dlg = $("#testDialog").dialog();
dlg.parent().appendTo(jQuery("form:first"));
};
</script>
</head>
<body>
<form id="f1" runat="server">
<asp:Button runat="server" ID="btn" Text="Test" OnClick="btnTest_Click" OnClientClick="showDialog();return false;" />
<div id="testDialog" >
<h3>
I'm Dialog</h3>
<asp:Button ID="Button1" runat="server" Text="Hit me!" OnClick="HitMe" />
</div>
</form>
</body>
</html>
$("#testDialog").dialog({autoOpen: false});触发:
$("#testDialog").dialog("open");
$(function () {
$("#testDialog").dialog({ autoOpen: false });
function showDialog() {
var dlg = $("#testDialog").dialog("open");
dlg.parent().appendTo(jQuery("form:first"));
}
});
</script>
<input id="btn" type="button" value="Show" />$(function() {
$("#dialog").dialog({
autoOpen: false,
width:200,
height:200
}); $("#btn").click(function() {
$("#dialog").dialog("open");
});
});