请问下: JQuery-UI 和ASP.Net的服务器端控件的问题 就是我现在想要个Dialog,当点击了服务器端的Button之后,就弹出Dialog提示,然后执行 Button的click事件;我现在的情况是 那个Dialog, 加载完成就弹出来了,然后点按钮的时候也能弹出来。————————请各位大侠指点一下————或者给个完整的Demo谢了先! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你是用jQuery写的?那就不要把弹Dialog的方法写在$(document).ready()里面 敢问楼主初始化dialog代码和触发dialog弹出的代码 <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> 初始化的时候加一个autoOpen: false 初始化:$("#testDialog").dialog({autoOpen: false});触发:$("#testDialog").dialog("open"); 你的意思是这样: <script type="text/javascript"> $(function () { $("#testDialog").dialog({ autoOpen: false }); function showDialog() { var dlg = $("#testDialog").dialog("open"); dlg.parent().appendTo(jQuery("form:first")); } }); </script> 说showDialog()为定义或者为空 <div id="dialog" title="test title" style="display:none"> test test</div><input id="btn" type="button" value="Show" />$(function() { $("#dialog").dialog({ autoOpen: false, width:200, height:200 }); $("#btn").click(function() { $("#dialog").dialog("open"); });}); javascript的调试 高分求助:如何使用JavaScript来做文本框输入数据的完整性验证?具体内容要求如下: html页面怎么获得控件值并当参数传入函数里. 这个该怎么取值呢?我的js水平太菜!!请大神指点一二。。 用javascript怎么连接EXCEL? 求写一复杂算法!!谢谢!! ★★★★★ 求一个正则表达式 ★★★★★ 请问:如何把一个层显示在屏幕的正中? 那里有好的HTML,JavaScript的学习资料呀 请教JQUERY代码 求助:JS键值对读取本地文件 如何替换文件名中的特殊字符?
那就不要把弹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");
});
});