这是我用过的脚本
<script type="text/javascript">
$(document).ready(function() {
$("#dialog").dialog({
autoOpen: true,
height: 300,
width: 350,
modal: true,
buttons: {
'Calling': function(){},
'Cancel' : function(){
$(this).dialog('close');
}
}
});
$('#id_call').click(function() {
$("#dialog").dialog("open");
});
});
</script>
在这一个按钮用于显示对话框
<button id="id_call">Click to Call</button>
但点击事件无法正常工作......
答案 0 :(得分:0)
你可以这样绑定这样的事件吗?
$('#id_call').bind('click', function() { $("#dialog").dialog("open"); });
答案 1 :(得分:0)
你可以试试这个:http://jsfiddle.net/K2C4n/
我更改了autoOpen: false
HTML:
<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<button id="id_call">Click to Call</button>
<div id="dialog" title="Dialog Title">I'm in a dialog</div>
</body>
</html>
jQuery的:
$(document).ready(function() {
$("#dialog").dialog({
autoOpen: false,
height: 300,
width: 350,
modal: true,
buttons: {
'Calling': function(){},
'Cancel' : function(){
$(this).dialog('close');
}
}
});
$('#id_call').click(function() {
$("#dialog").dialog("open");
});
});
编辑:不要忘记包含jQuery和jQueryUI。