我之前在这个论坛上的 qstn 是关于动态地将文本分配给 jquery 中的按钮,我在这里得到了解决方案。现在我的问题是,单击该按钮后,我必须打开另一个带有 2 个按钮的 UI 对话框。我已经编写了以下代码。我能够打开 UI 对话框,但没有出现按钮。请帮助我更改我的代码。
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
</head>
<body>
<div id="selector" title="Pop Up" class = "selector"> <p><span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span> Do u want to save the score?</p> </div>
<script>
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var today = new Date();
var month = monthNames[today.getMonth()];
var nextMonth = monthNames[today.getMonth() + 1];
$(".selector").dialog({buttons: [
{
text: month,
click: function() {
$("#opener").dialog({modal: true, height: 590, width: 1005 });
$(this).dialog("close");
}
},
{
text: nextMonth,
click: function() {
$(this).dialog('close');
}
}
]});
</script>
<script>
$(".opener").dialog({buttons: [
{
text: "ok",
click: function() {
$(this).dialog("open");
}
},
{
text: "cancel",
click: function() {
$(this).dialog('open');
}
}
]});
</script>
<div id="opener" title="Pop Up" class = "opener" width ="100px">
<p><span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
Score will be updated</p> </div>
</body>