質問編集履歴

3

ご指摘をうけて変更いたしました。

2017/01/17 03:49

投稿

next.wing
next.wing

スコア13

test CHANGED
File without changes
test CHANGED
@@ -70,29 +70,43 @@
70
70
 
71
71
  </form>
72
72
 
73
- <script>
74
-
75
- var num = "〇";
76
-
77
- // データの保存
78
-
79
- window.localStorage.setItem('access_count', num);
80
-
81
- (div.toString());
82
-
83
- </script>
84
-
85
73
  </body>
86
74
 
87
75
  </html>
88
76
 
77
+ <script>
78
+
79
+ var num = "〇";
80
+
81
+ // データの保存
82
+
83
+ window.localStorage.setItem('access_count', num);
84
+
85
+ </script>
86
+
89
87
  </ons-navigator>
90
88
 
91
89
  ```
92
90
 
93
- そこで上記スコードに(div.toString());をいれてみたところアラートは何も出ませんした。
91
+ ご指摘を受け、チェックシート(sheet.html)に下記の文をいれてみたすが、
92
+
94
-
93
+ やはり画像は受け取ることができるのですが、チェックシートには〇が付きませんでした。
94
+
95
-
95
+ ```html
96
+
97
+ window.onload = function() {
98
+
99
+ bbbValue = window.localStorage.getItem('access_count');//localStorageから値を取得
100
+
101
+ console.log(bbbValue);//bbbの値が確認できたら、このコードは削除してください。
102
+
103
+ var tableCellbbb = document.getElementById( "test_bbb" ) ;//テーブル内の値を入れる部分を宣言
104
+
105
+ tableCellbbb.innerHTML = bbbValue ; //テーブル内の値を置き換える
106
+
107
+ }
108
+
109
+ ```
96
110
 
97
111
  ###実現したいこと
98
112
 
@@ -152,14 +166,6 @@
152
166
 
153
167
  <div id="test_bbb"></div>
154
168
 
155
- <script type="text/javascript">
156
-
157
- var div = window.localStorage.getItem('access_count');
158
-
159
- document.write(div.toString());
160
-
161
- </script>
162
-
163
169
  </td>
164
170
 
165
171
  </tr>
@@ -176,6 +182,20 @@
176
182
 
177
183
  </html>
178
184
 
179
-
185
+ <script type="text/javascript">
186
+
180
-
187
+ window.onload = function() {
188
+
189
+ bbbValue = window.localStorage.getItem('access_count');//localStorageから値を取得
190
+
191
+ console.log(bbbValue);//bbbの値が確認できたら、このコードは削除してください。
192
+
193
+ var tableCellbbb = document.getElementById( "test_bbb" ) ;//テーブル内の値を入れる部分を宣言
194
+
195
+ tableCellbbb.innerHTML = bbbValue ; //テーブル内の値を置き換える
196
+
197
+ }
198
+
199
+ </script>
200
+
181
- ```
201
+ ```

2

ページをまとめてみました。

2017/01/17 03:49

投稿

next.wing
next.wing

スコア13

test CHANGED
@@ -1 +1 @@
1
- リリスビルドでうまく動です。
1
+ コンら受け取るページの処理につ
test CHANGED
@@ -1,94 +1,48 @@
1
- ###前提・実現したいこと
1
+ ###前提
2
2
 
3
3
  monacaを使いアンドロイドスマートフォンアプリを作成しています。
4
4
 
5
- ビーコンスタンプラリーアプリです。
5
+ ビーコンスタンプラリーアプリというものです。
6
6
 
7
7
 
8
8
 
9
- ビーコンに近づくと(スタンプラリーの拠点)「〇」の印をチェックシート(sheet.html)につけたいのですが、スタンプラリーの拠点にあるビーコンに近づくと、ビーコンは反応して画像が表示されるのですがチェックシートに「〇」が付きません。
9
+ ビーコンに近づくと(スタンプラリーの拠点)「〇」の印をチェックシート(sheet.html)にある表につけたいのですが、スタンプラリーの拠点にあるビーコンに近づくと、ビーコンは反応して画像が表示されるのですがチェックシートに「〇」が付きません。
10
10
 
11
11
 
12
12
 
13
- localStorageを使ています。
13
+ localStorageを使い値を保存しようとしています。
14
14
 
15
15
 
16
16
 
17
+ ###現状
18
+
17
- ###スタンプラリーチェックシートページ
19
+ 下記のソーコードで、作られるボタンhtmlページ
18
20
 
19
21
  ```html
20
22
 
21
- <!--sheet.html-->
22
-
23
- <!DOCTYPE HTML>
24
-
25
- <html ng-app="BeaconProject">
26
-
27
- <head>
28
-
29
- <meta charset="utf-8">
30
-
31
- </head>
32
-
33
-
34
-
35
- <body>
36
-
37
- <script type="text/javascript">
38
-
39
- </script>
40
-
41
- <!-- <center><h1>チェックシート</h1></center> -->
42
-
43
- <br />
44
-
45
- <div data-role="content">
46
-
47
- <center>
48
-
49
- <table id="rankingTable" border="1" width="90%" cellspacing="1" cellpadding="5">
23
+ <input type="button" onclick="location.href='test.html?bk=1'" value="テスト" style="WIDTH: 100%; HEIGHT: 40px">
50
-
51
- <tr>
52
-
53
- <th align="right" nowrap>まいまいず井戸</th>
54
-
55
- <td id= "check_1"align="center" width="150">
56
-
57
- <div id="test_bbb"></div>
58
-
59
- <script type="text/javascript">
60
-
61
- var div = window.localStorage.getItem('access_count');
62
-
63
- document.write(div.toString());
64
-
65
- </script>
66
-
67
- </td>
68
-
69
- </tr>
70
-
71
- </table> <br />
72
-
73
- </center>
74
-
75
- </div>
76
-
77
- </div>
78
-
79
- </body>
80
-
81
- </html>
82
-
83
-
84
24
 
85
25
  ```
86
26
 
87
- ###ビーコンのペ
27
+ 下記のソコードを入れたところチェックシートに「〇」が付きました。
88
28
 
89
29
  ```html
90
30
 
31
+ <script>
32
+
33
+ var num = "〇";
34
+
35
+ window.localStorage.setItem('access_count', num);
36
+
37
+ </script>
38
+
39
+ ```
40
+
41
+ しかし、ビーコンに接近したときに受け取るhtmlのページに組み込んでも反応しませんでした。
42
+
43
+ ```html
44
+
91
- <!--beacon.html-->
45
+ <!--beacon.html これがビーコンのページです-->
92
46
 
93
47
  <!DOCTYPE HTML>
94
48
 
@@ -124,6 +78,8 @@
124
78
 
125
79
  window.localStorage.setItem('access_count', num);
126
80
 
81
+ (div.toString());
82
+
127
83
  </script>
128
84
 
129
85
  </body>
@@ -134,24 +90,92 @@
134
90
 
135
91
  ```
136
92
 
137
- ###試したこと
93
+ そこで上記のソースコードに(div.toString());をいれてみたところアラートは何も出ませんでした
138
94
 
139
- 別のhtmlページを作成し、そこに移動するボタンをつくりページ内に↓を書いたところチェックシートに〇印が付きました。
140
95
 
141
- ```
142
96
 
143
- <script>
97
+ ###実現したいこと
144
98
 
145
- var num = "";
99
+ ビーコンからページを受け取り、チェックシートの表に「」が書き込まれるようにしたいです。
146
100
 
147
- window.localStorage.setItem('access_count', num);
148
101
 
149
- </script>
150
102
 
151
- ```
103
+
104
+
105
+
152
106
 
153
107
 
154
108
 
155
109
  ###補足情報(言語/FW/ツール等のバージョンなど)
156
110
 
157
111
  プログラミング初心者なため不要な部分のソースコードがありましたら申し訳ありません。
112
+
113
+ チェックシートのページは下記になります。
114
+
115
+ ```html
116
+
117
+ <!--sheet.html これがチェックシートのページです-->
118
+
119
+ <!DOCTYPE HTML>
120
+
121
+ <html ng-app="BeaconProject">
122
+
123
+ <head>
124
+
125
+ <meta charset="utf-8">
126
+
127
+ </head>
128
+
129
+
130
+
131
+ <body>
132
+
133
+ <script type="text/javascript">
134
+
135
+ </script>
136
+
137
+ <!-- <center><h1>チェックシート</h1></center> -->
138
+
139
+ <br />
140
+
141
+ <div data-role="content">
142
+
143
+ <center>
144
+
145
+ <table id="rankingTable" border="1" width="90%" cellspacing="1" cellpadding="5">
146
+
147
+ <tr>
148
+
149
+ <th align="right" nowrap>まいまいず井戸</th>
150
+
151
+ <td id= "check_1"align="center" width="150">
152
+
153
+ <div id="test_bbb"></div>
154
+
155
+ <script type="text/javascript">
156
+
157
+ var div = window.localStorage.getItem('access_count');
158
+
159
+ document.write(div.toString());
160
+
161
+ </script>
162
+
163
+ </td>
164
+
165
+ </tr>
166
+
167
+ </table>
168
+
169
+ <br />
170
+
171
+ </center>
172
+
173
+ </div>
174
+
175
+ </body>
176
+
177
+ </html>
178
+
179
+
180
+
181
+ ```

1

少し見やすくなりました。

2017/01/17 00:47

投稿

next.wing
next.wing

スコア13

test CHANGED
File without changes
test CHANGED
@@ -13,64 +13,6 @@
13
13
  localStorageを使っています。
14
14
 
15
15
 
16
-
17
- ###トップページ
18
-
19
- ```html
20
-
21
- <!--top.html-->
22
-
23
- <!DOCTYPE HTML>
24
-
25
- <html ng-app="BeaconProject">
26
-
27
- <head>
28
-
29
- <meta charset="utf-8">
30
-
31
- </head>
32
-
33
-
34
-
35
-
36
-
37
- <body>
38
-
39
-
40
-
41
- <!-- ビーコン -->
42
-
43
- <ons-navigator var="beaconNavigator">
44
-
45
- <ons-page ng-controller="TopPageCtrl">
46
-
47
-
48
-
49
- <!-- トップ画面 -->
50
-
51
- <div data-role="page" id="list-page" bgcolor="#90ee90">
52
-
53
- <div data-role="header" data-position="fixed" data-theme="c"></div>
54
-
55
- <center>
56
-
57
- <h1>Top page</h1>
58
-
59
- <input type="button" onclick="location.href='sheet.html?bk=1'" value="チェックシート" style="WIDTH: 100%; HEIGHT: 40px">
60
-
61
- </center>
62
-
63
- </div>
64
-
65
-
66
-
67
- </ons-page>
68
-
69
- </ons-navigator>
70
-
71
- </html>
72
-
73
- ```
74
16
 
75
17
  ###スタンプラリーのチェックシートページ
76
18
 
@@ -194,7 +136,7 @@
194
136
 
195
137
  ###試したこと
196
138
 
197
- 別のhtmlページを作成し、そこに移動するボタンをトップ画面につくりページ内に↓を書いたのですが、monacaのプレビューでは反応したのですが、リリースビルドを行ったところ反応しせんでした。
139
+ 別のhtmlページを作成し、そこに移動するボタンをつくりページ内に↓を書いたところチェックシートに〇印が付きました。
198
140
 
199
141
  ```
200
142