-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathiframe.html
62 lines (53 loc) · 1.57 KB
/
iframe.html
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>iframe Test</title>
</head>
<body>
<div>
数据传递测试:<br /><input id="text1" value="Hello MDialog" /><br />
<button id="btn1">刷新本框架页</button><br />
<button id="btn2">在顶层页打开新对话框</button><br />
<button id="btn3">点击我关闭弹窗</button><br />
<button id="btn4">设置本对话框的高度</button><br />
<button id="btn5">设置本对话框的宽度</button><br />
<button id="btn6">改变当前对画框的标题</button><br />
<button id="btn7">给当前对画框增加按钮</button>
<script type="text/javascript">
//这里获取当前对话框
var d = top.$M.getIframe(window.name);
var $$ = function( id ){
return typeof id == 'string' && document.getElementById(id);
};
$$('btn1').onclick = function(){
top.window.location.reload();
};
$$('btn2').onclick = function(){
var newDialog = top.$M({
title: 'Hello World',
content: '我是从 iframe 弹出的新弹窗',
lock: true,
time: 5
});
};
$$('btn3').onclick = function(){ d.close(); };
$$('btn4').onclick = function(){ d.height(400); };
$$('btn5').onclick = function(){ d.width(400); };
$$('btn6').onclick = function(){ d.title('我是iframe新标题'); };
$$('btn7').onclick = function(){
d.button([{
name: '同意',
callback: function () {
this.title('你同意了,2秒后自动关闭').time(2);
return false;
},
focus: true
},{
name: '关闭我'
}]);
};
</script>
</div>
</body>
</html>