質問編集履歴
2
コードブロックで囲む
title
CHANGED
File without changes
|
body
CHANGED
@@ -29,6 +29,7 @@
|
|
29
29
|
・blank.htm (iframe)
|
30
30
|
|
31
31
|
■main.htm
|
32
|
+
```ここに言語を入力
|
32
33
|
<!DOCTYPE html>
|
33
34
|
<html>
|
34
35
|
<head>
|
@@ -37,7 +38,7 @@
|
|
37
38
|
<link rel="stylesheet" href="handsontable.full.min.css" />
|
38
39
|
</head>
|
39
40
|
<body>
|
40
|
-
|
41
|
+
<button id="executeSelf">execute(self)</button>
|
41
42
|
<button id="execute">execute(iframe)</button>
|
42
43
|
<div id="grid">
|
43
44
|
</div>
|
@@ -71,7 +72,7 @@
|
|
71
72
|
|
72
73
|
document.body.appendChild(ifr)
|
73
74
|
ifr.onload = (e) =>{
|
74
|
-
|
75
|
+
// ここのnewでエラー
|
75
76
|
var grid = ifr.contentWindow.document.getElementById("grid")
|
76
77
|
new Handsontable(grid, {data: data});
|
77
78
|
}
|
@@ -80,8 +81,10 @@
|
|
80
81
|
</script>
|
81
82
|
</body>
|
82
83
|
</html>
|
84
|
+
```
|
83
85
|
|
84
86
|
■blank.htm(iframeがsrcしてる)
|
87
|
+
```ここに言語を入力
|
85
88
|
<!DOCTYPE html>
|
86
89
|
<html>
|
87
90
|
<head>
|
@@ -95,6 +98,7 @@
|
|
95
98
|
</div>
|
96
99
|
</body>
|
97
100
|
</html>
|
101
|
+
```
|
98
102
|
|
99
103
|
|
100
104
|
### 試したこと
|
1
ソースコードを記載
title
CHANGED
File without changes
|
body
CHANGED
@@ -23,6 +23,80 @@
|
|
23
23
|
http://testserver78.html.xdomain.jp/main.htm
|
24
24
|
を参照ください。
|
25
25
|
|
26
|
+
全体像
|
27
|
+
・main.htm (起動画面)
|
28
|
+
└handsontable.full.js (ライブラリ)
|
29
|
+
・blank.htm (iframe)
|
30
|
+
|
31
|
+
■main.htm
|
32
|
+
<!DOCTYPE html>
|
33
|
+
<html>
|
34
|
+
<head>
|
35
|
+
<meta charset="UTF-8" />
|
36
|
+
<title>Handsontable</title>
|
37
|
+
<link rel="stylesheet" href="handsontable.full.min.css" />
|
38
|
+
</head>
|
39
|
+
<body>
|
40
|
+
<button id="executeSelf">execute(self)</button>
|
41
|
+
<button id="execute">execute(iframe)</button>
|
42
|
+
<div id="grid">
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<script src="handsontable.full.js"></script>
|
46
|
+
<script type="text/javascript">
|
47
|
+
document.getElementById("executeSelf").addEventListener("click", (e)=>{
|
48
|
+
var data = [
|
49
|
+
['佐藤', 28],
|
50
|
+
['鈴木', 19],
|
51
|
+
['田中', 25]
|
52
|
+
];
|
53
|
+
|
54
|
+
var grid = document.getElementById('grid');
|
55
|
+
new Handsontable(grid, {data: data});
|
56
|
+
})
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
document.getElementById("execute").addEventListener("click", (e)=>{
|
62
|
+
var data = [
|
63
|
+
['佐藤', 28],
|
64
|
+
['鈴木', 19],
|
65
|
+
['田中', 25]
|
66
|
+
];
|
67
|
+
|
68
|
+
|
69
|
+
var ifr = document.createElement("iframe")
|
70
|
+
ifr.src="blank.htm"
|
71
|
+
|
72
|
+
document.body.appendChild(ifr)
|
73
|
+
ifr.onload = (e) =>{
|
74
|
+
// ここのnewでエラーになる
|
75
|
+
var grid = ifr.contentWindow.document.getElementById("grid")
|
76
|
+
new Handsontable(grid, {data: data});
|
77
|
+
}
|
78
|
+
})
|
79
|
+
|
80
|
+
</script>
|
81
|
+
</body>
|
82
|
+
</html>
|
83
|
+
|
84
|
+
■blank.htm(iframeがsrcしてる)
|
85
|
+
<!DOCTYPE html>
|
86
|
+
<html>
|
87
|
+
<head>
|
88
|
+
<meta charset="UTF-8" />
|
89
|
+
<title>Handsontable</title>
|
90
|
+
<link rel="stylesheet" href="handsontable.full.min.css" />
|
91
|
+
</head>
|
92
|
+
<body>
|
93
|
+
<span>ChildIframe</span>
|
94
|
+
<div id="grid">
|
95
|
+
</div>
|
96
|
+
</body>
|
97
|
+
</html>
|
98
|
+
|
99
|
+
|
26
100
|
### 試したこと
|
27
101
|
・callによるthisの書き換えでwindowを変更する
|
28
102
|
→windowは変わらない
|