-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbox-confirm.html
More file actions
33 lines (31 loc) · 1.25 KB
/
box-confirm.html
File metadata and controls
33 lines (31 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html>
<head>
<link href="https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/classic/theme-classic/resources/theme-classic-all.css" rel="stylesheet" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/ext-all.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
Ext.create('Ext.Button', {
renderTo: Ext.getElementById('msgBox'),
text: 'Click Me',
listeners: {
click: function() {
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to do this ?', callbackFunction); // 此消息框要求用户确认以及对不同选项用户选择调用的不同方法为yes或no。
function callbackFunction(btn){ // 回调函数
if(btn == 'yes') {
Ext.Msg.alert ('Button Click', 'You clicked the Yes button');
} else {
Ext.Msg.alert ('Button Click', 'You clicked the No button');
}
};
}
}
});
});
</script>
</head>
<body>
<p> Click the button for alert box </p>
<div id = "msgBox" ></div>
</body>
</html>