觸發對話框
觸發對話框可使任意一個事件,在此我以單擊事件爲例
例,「<div id='da'></div>」
在單擊此元素是,觸發對話框
$("#da").click(function(){
$("#dd").dialog("open");//打開對話框
} <html>
<head>
<script src="jquery.ui.core.js"></script>
<script src="jquery.ui.widget.js"></script>
<script src="jquery.ui.mouse.js"></script>
<script src="jquery.ui.position.js"></script>
<script src="jquery.ui.resizable.js"></script>
<script src="jquery.ui.draggable.js"></script>
<script src="jquery.ui.sortable.js"></script>
<script src="jquery.ui.dialog.js"></script>
</head>
<body>
<div id="dd"><span>你好</span></div>
<div id="da"></div>
<script type="text/javascript">
$(function(){
$("#dd").dialog({
title:"",
autoOpen:false,
width:300,
height:200,
closeOnEscape:false,
draggable:true,
resizable:false,
modal:true,
position:["center","center"]
});
$("#da").click(function(){
$("#dd").dialog("open");
});
});
</script>
<body>
</html>
);