質問編集履歴
4
文法の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
### 前提・実現したいこと
|
2
2
|
|
3
3
|
valueの値を取得してその値ごとにactionを動的に変え、遷移時にフェードアウトさせようとしているのですが、
|
4
|
-
sex-age.htmlこのページにおいてvalue="man"を選択しsubmitしたらactionが書き換わり遷移されると思ったのですが
|
4
|
+
sex-age.htmlこのページにおいてvalue="man"を選択しsubmitしたらactionが書き換わり遷移されると思ったのですが、遷移されず同じページに戻されます
|
5
5
|
if(url.match(/sex-age.html/)){
|
6
6
|
if(document.sexageform.sex.value == "man"){
|
7
7
|
|
3
HTML追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -10,8 +10,42 @@
|
|
10
10
|
ここに引っかかりません、console.logで確認しても値が表示できなかったのでなぜここに引っかからないのかがわかりません。
|
11
11
|
原因がわかる方がいましたら、教えていただければ幸いです。
|
12
12
|
|
13
|
+
###html
|
14
|
+
```
|
15
|
+
<main>
|
16
|
+
<div class="s-contents">
|
17
|
+
<form method="get" class="form" id="sex-age" name="sexageform" data-validate>
|
18
|
+
<h2 class="s-heading age-heading">あなたの性別は?</h2>
|
19
|
+
<div class="s-radio-box">
|
20
|
+
<div class="btn corner-border corner-button">
|
21
|
+
<input id="man" type="radio" name="sex" value="man">
|
22
|
+
<label for="man" class=" corner-border__inner">
|
23
|
+
<img src="/check/common/img/man.png" alt="" class="border">
|
24
|
+
</label>
|
25
|
+
</div>
|
26
|
+
<div class="btn corner-border corner-button">
|
27
|
+
<input id="woman" type="radio" name="sex" value="woman">
|
28
|
+
<label for="woman" class=" corner-border__inner">
|
29
|
+
<img src="/check/common/img/woman.png" alt="" class="border">
|
30
|
+
</label></div>
|
31
|
+
</div>
|
32
|
+
<h2 class="s-heading">あなたの年齢は?</h2>
|
33
|
+
<div class="age">
|
34
|
+
<input type="number" name="age" max="60" min="20" placeholder="年齢" id="number" required>
|
35
|
+
</div>
|
36
|
+
<div class="s-btn-line">
|
37
|
+
<a href="javascript:void(0);" onclick="window.history.back();"><img src="/check/common/img/return.png" alt=""></a>
|
38
|
+
<input type="submit" value="次へ" onclick="puff()" id="next" disabled="disabled">
|
39
|
+
<div class=""></div>
|
40
|
+
</div>
|
41
|
+
</form>
|
42
|
+
</div>
|
43
|
+
</main>
|
13
44
|
|
14
45
|
```
|
46
|
+
|
47
|
+
### js
|
48
|
+
```
|
15
49
|
let body = document.getElementsByTagName('body')[0];
|
16
50
|
|
17
51
|
function fadeOut() {
|
2
文法の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
### 前提・実現したいこと
|
2
2
|
|
3
3
|
valueの値を取得してその値ごとにactionを動的に変え、遷移時にフェードアウトさせようとしているのですが、
|
4
|
-
sex-age.htmlこのページにおいてvalue="man"を選択しsubmitし
|
4
|
+
sex-age.htmlこのページにおいてvalue="man"を選択しsubmitしたらactionが書き換わり遷移されると思ったのですが
|
5
5
|
if(url.match(/sex-age.html/)){
|
6
6
|
if(document.sexageform.sex.value == "man"){
|
7
7
|
|
1
文法の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
### 前提・実現したいこと
|
2
2
|
|
3
3
|
valueの値を取得してその値ごとにactionを動的に変え、遷移時にフェードアウトさせようとしているのですが、
|
4
|
+
sex-age.htmlこのページにおいてvalue="man"を選択しsubmitしても
|
4
|
-
|
5
|
+
if(url.match(/sex-age.html/)){
|
6
|
+
if(document.sexageform.sex.value == "man"){
|
7
|
+
|
8
|
+
document.sexageform.action="/check/point_men.html";
|
9
|
+
}
|
5
|
-
|
10
|
+
ここに引っかかりません、console.logで確認しても値が表示できなかったのでなぜここに引っかからないのかがわかりません。
|
6
11
|
原因がわかる方がいましたら、教えていただければ幸いです。
|
7
12
|
|
8
13
|
|
@@ -16,17 +21,13 @@
|
|
16
21
|
// 遷移先切り分け
|
17
22
|
function linkUrl(){
|
18
23
|
let url = location.href ;
|
19
|
-
|
24
|
+
|
20
25
|
if(url.match(/sex-age.html/)){
|
21
|
-
console.log("testtest");
|
22
26
|
if(document.sexageform.sex.value == "man"){
|
23
|
-
|
24
|
-
location.href = '/check/point_men.html';
|
25
27
|
|
26
|
-
|
28
|
+
document.sexageform.action="/check/point_men.html";
|
27
29
|
}
|
28
30
|
else if(document.sexageform.sex.value == "woman"){
|
29
|
-
document.sexageform.submit();
|
30
31
|
|
31
32
|
document.sexageform.action="/check/point_women.html";
|
32
33
|
}
|
@@ -42,7 +43,6 @@
|
|
42
43
|
}
|
43
44
|
}
|
44
45
|
else if(url.match(/check.html/)){
|
45
|
-
// ここだけ反応する
|
46
46
|
location.href = '/check/sex-age.html';
|
47
47
|
}
|
48
48
|
else if(url.match(/point/)){
|