<a id="dialog_link" class="ui-state-dfault ui-corner-all" href="##"><span> </span>open </a>
<!--div $("#dialog").dialog() 他就成了一个对话框 在页面中就会隐藏-->
<div id="dialog" title=" 文本框中的title">
文本框中的内容
</div>
<script src="../jquery/jquery-1.7.1.js"></script>
<script src="../jquery/jquery-ui-1.8.18.custom.min.js"></script>
<!--引入css-->
<link rel="stylesheet" href="../jquery/css/jquery-ui-1.8.18.custom.css" />
<script>
$(function(){
//注册对话框
$("#dialog").dialog({
autoOpen:false , //设置对话框的打开方式不是自动打开
show:'blind', //打开时的动画效果
hide:'explode', //关闭时的动画效果
modal:true, //遮罩效果 false 非遮罩效果
resizable:false,
/* buttons:{ //添加按钮操作
"确定":function(){
//alert("确定");
$(this).dialog("close");
},
"取消":function(){
// alert("取消");
$(this).dialog("close");
}
},*/
//效果与上边的buttons效果相同
buttons:[
{
text:"ok",
click:function(){
$(this).dialog("close");
}
},
{
text:"取消",
click:function(){
$(this).dialog("close");
}
}],
draggable:true, //是否可以拖动 默认true 可以拖动
closeOnEscape:false , //是否采用esc键退出对话框 默认值是true 采用
title:"添加用户",//对话框的标题
position:"top", //对话框弹出的位置 可以使用top left right bottom center默认值是center
width:400, //设置对话框的宽度
height:400, //对话框的高度
resixable:false, //是否改变的操作 false则不可以改变尺寸 true 不可以
zIndex:2, //层叠的效果
drag:function(event,ui){
$("#dialog").html("文本框添加");
//可以的到当前的坐标位置
}
});
//触发链接事件,当点击连接时 打开对话框
$("#dialog_link").click(function(){
$("#dialog").dialog("open");//open参数 作用 打开对话框
});
//怎样获取 设置的options中的参数值
var modalValue=$("#dialog").dialog("option","modal");
alert(modalValue);
//我怎么设置options中的参数值
$("#dialog").dialog("option","modal",false);
});
</script>