jqueryui的dialog组件

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link rel="stylesheet" href="css/smoothness/jquery-ui-1.8.9.custom.css">
<title>Dialog</title>
<script
src="development-bundle/jquery-1.4.4.js">
</script>
<script
src="development-bundle/ui/jquery.ui.core.js">
</script>
<script
src="development-bundle/ui/jquery.ui.widget.js">
</script>
<script
src="development-bundle/ui/jquery.ui.position.js">
</script>
<script
src="development-bundle/ui/jquery.ui.dialog.js">
</script>
<script src="development-bundle/ui/jquery.ui.mouse.js">
</script>
<script
src="development-bundle/ui/jquery.ui.draggable.js">
</script>
<script
src="development-bundle/ui/jquery.ui.resizable.js">
</script>
<script>
$(function(){
var execute = function(){
     var answer = $("#myDialog").find("input:checked").val();//获取对话框中的值
     $("<p>").text("Thanks for selecting " + answer).appendTo($("body"));
     $("#myDialog").dialog("close");
};
var cancel = function() {$("#myDialog").dialog("close"); };
var dialogOpts = {
	//title: '<a href="#">A link title!</a>',  //设置标题
	modal: true,
	buttons: {
	"Ok": execute,
	"Cancel": cancel},
	//show: true,   //设置打开动画
    //hide: true,
	width: 500,
	height: 300,
	minWidth: 150,
	minHeight: 150,
	maxWidth: 600,
	maxHeight: 450,
	/**********************事件***************************/
	open: function() {
	   $("#status").children(":last").text("The dialog is open");
	},
	close: function() {
	   $("#status").children(":last").text("The dialog is closed");
	},
	beforeclose: function() {
	    if ($(".ui-dialog").css("width") > 300) {
	            return false;
	     }
	},
	//autoOpen:false
	autoOpen:true
    };
	
	$("#myDialog").dialog(dialogOpts);
	
	$("#toggle").click(function() {
		if(!$("#myDialog").dialog("isOpen")) {
		   $("#myDialog").dialog("open");
		} else {
		   $("#myDialog").dialog("close");
		}
	});
});
</script>
</head>
<body>
<!--<div id="myDialog" title="This is the title!"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  Aenean sollicitudin. Sed interdum pulvinar justo. Nam iaculis
  volutpat ligula. Integer vitae felis quis diam laoreet
  ullamcorper. Etiam tincidunt est vitae est. </div>
<!--<div id="dialog2" title="Dialog 2"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean
  sollicitudin. Sed interdum pulvinar justo. Nam iaculis volutpat
  ligula. Integer vitae felis quis diam laoreet ullamcorper. Etiam
  tincidunt est vitae est. </div>-->
<!--<div id="status" class="ui-widget ui-dialog ui-corner-all
ui-widget-content">
  <div class="ui-widget-header ui-dialog-titlebar
ui-corner-all">Dialog Status </div>
  <div class="ui-widget-content ui-dialog-content"> </div>
</div>-->
<!--<button type="button" id="toggle">Toggle dialog!</button>
-->
<p>Please answer the opinion poll:
</p>
<div id="myDialog" title="Best Widget Library">
  <p>Is jQuery UI the greatest JavaScript widget library? </p>
  <label for="yes">Yes! </label>
  <input type="radio" id="yes" value="yes" name="question" checked="checked">
  <br>
  <label for="no">No! </label>
  <input type="radio" id="no" value="no" name="question">
</div>
</body>
</html>


对话框选项:

 

事件:

 

方法:

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值