使用dialog插件弹出提示和确定信息对话框8-8

dialog参数说明:http://www.cnblogs.com/bestfc/archive/2009/06/08/1498742.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>使用dialog插件弹出提示和确定信息对话框</title>
<script type="text/javascript" src="lib/jquery-2.1.1.js"></script>
<script type="text/javascript" src="lib/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery-ui.css">
<style type="text/css">
	body{font-size:13px}
	.txt{border:#666 1px solid;padding:2px;width:180px;margin-right:3px}
	button,.btn{border:#666 1px solid;padding:2px;width:60px;}
</style>
<script type="text/javascript">
	$(function(){
		$("#btnSubmit").bind("click",function(){
			if($("#txtName").val()==""){
				sys_Alert("姓名不能为空!请输入姓名")
			}
		});

		$("#btnDelete").bind("click",function(){
			if($("#spnName").html()!=null){
				sys_Confirm("您真的要删除该条记录吗?");
				return false;
			}
		});
	});

	function sys_Alert(content){
		$("#dialog-modal").dialog({
			height:140,
			modal:true,
			title:'系统提示',
			hide:'slide',
			buttons:{
				Cancel:function(){
					$(this).dialog("close");
				}
			},
			open:function(){
				$(this).html("");
				$(this).append("<p>"+content+"</p>");
			}
		});
	}

	function sys_Confirm(content){
		$("#dialog-modal").dialog({
			height:140,
			modal:true,
			title:'系统提示',
			hide:'slide',
			buttons:{
				'确定':function(){
					$("#spnName").remove();
					$(this).dialog("close");
				},
				'取消':function(){
					$(this).dialog("close");
				}
			},
			open:function(event,ui){
				$(this).html("");
				$(this).append("<p>"+content+"</p>")
			}
		});
	}
</script>
</head>
<body>

	<div>
		<div style="background-color:#eee;padding:5px;width:260px">
			<input id="txtName" type="text" class="txt"/>
			<input id="btnSubmit" type="button" value="提交" class="btn"/>
		</div>
		<div style="padding:5px;width:260px">
			<span id="spnName">张三</span>
			<input id="btnDelete" type="button" value="删除" class="btn"/>
		</div>
		<div id="dialog-modal"></div>
	</div>
	
</body>
</html>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值