回答編集履歴
1
コード例の追加
test
CHANGED
@@ -39,3 +39,79 @@
|
|
39
39
|
|
40
40
|
|
41
41
|
これならJavaScriptのみで処理可能です
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
以下追記
|
46
|
+
|
47
|
+
```JavaScript
|
48
|
+
|
49
|
+
// 2ページ目の次へボタンクリック処理
|
50
|
+
|
51
|
+
function page2NextClick() {
|
52
|
+
|
53
|
+
var ans1 = 画面部品から答えを取得;
|
54
|
+
|
55
|
+
window.location.href = "page3.html?" + ans1
|
56
|
+
|
57
|
+
}
|
58
|
+
|
59
|
+
// 3ページ目の次へボタンクリック処理
|
60
|
+
|
61
|
+
function page3NextClick() {
|
62
|
+
|
63
|
+
var ans1 = location.search.substring(1);
|
64
|
+
|
65
|
+
var ans2 = 画面部品から答えを取得;
|
66
|
+
|
67
|
+
window.location.href = "page4.html?" + ans1 + "," + ans2;
|
68
|
+
|
69
|
+
}
|
70
|
+
|
71
|
+
// 4ページ目の次へボタンクリック処理
|
72
|
+
|
73
|
+
function page4NextClick() {
|
74
|
+
|
75
|
+
var ans12 = location.search.substring(1);
|
76
|
+
|
77
|
+
var ans1 = ans12.split(",")[0];
|
78
|
+
|
79
|
+
var ans2 = ans12.split(",")[1];
|
80
|
+
|
81
|
+
var ans3 = 画面部品から答えを取得;
|
82
|
+
|
83
|
+
window.location.href = "page5.html?" + ans1 + "," + ans2 + "," + ans3;
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
// 5ページ目の画面ロード時処理
|
88
|
+
|
89
|
+
function page5Onload() {
|
90
|
+
|
91
|
+
var ans123 = location.search.substring(1);
|
92
|
+
|
93
|
+
var ans1 = ans123.split(",")[0];
|
94
|
+
|
95
|
+
var ans2 = ans123.split(",")[1];
|
96
|
+
|
97
|
+
var ans3 = ans123.split(",")[2];
|
98
|
+
|
99
|
+
// 採点処理
|
100
|
+
|
101
|
+
}
|
102
|
+
|
103
|
+
```
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
location.searchで現在のURLの?以下を取得できます
|
108
|
+
|
109
|
+
※http://hogehoge/hoge.html?aaaの場合 ?aaaが取得
|
110
|
+
|
111
|
+
substringで文字列を切り取ります
|
112
|
+
|
113
|
+
解答が2つ以上の場合URLへ?answer1,answer2,answer3
|
114
|
+
|
115
|
+
と「,]で連結し
|
116
|
+
|
117
|
+
splitで分割になります
|