質問編集履歴

1

具体的な内容、解決した内容の変更

2018/06/27 11:27

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -21,3 +21,143 @@
21
21
 
22
22
 
23
23
  調べて見たのですが、うまくいかず...お力添えお願いしますm(_ _)m
24
+
25
+
26
+
27
+
28
+
29
+ 【追記】
30
+
31
+ 丸投げですみません!
32
+
33
+ コードは以下の内容です。調べたと言っても意味を理解できておらず
34
+
35
+ コード自体は参考サイトのコピペのまま変わりはありません。汗
36
+
37
+
38
+
39
+ ```
40
+
41
+ <script>
42
+
43
+ document.addEventListener('click',function(e){
44
+
45
+ var t=e.target;
46
+
47
+ var url={
48
+
49
+ "1_1":"1.html",
50
+
51
+ "1_2":"2.html",
52
+
53
+ "2_1":"3.html",
54
+
55
+ "2_2":"4.html",
56
+
57
+ }
58
+
59
+ if(t.nodeName=="INPUT" && t.type=="submit" && t.value=="移動"){
60
+
61
+ var n1=document.querySelector('input[type=radio][name=room]:checked');
62
+
63
+ var n2=document.querySelector('input[type=radio][name=book]:checked');
64
+
65
+ if(n1 == null || n2 == null || typeof url[n1.value+"_"+n1.value]=="undefined"){
66
+
67
+ e.preventDefault();
68
+
69
+ }else{
70
+
71
+ alert(url[n1.value+"_"+n2.value]);
72
+
73
+ }
74
+
75
+ }
76
+
77
+ });
78
+
79
+
80
+
81
+ </script>
82
+
83
+ <form method="post">
84
+
85
+ <p>
86
+
87
+ <input type="radio" name="room" value="1">リビング
88
+
89
+ <input type="radio" name="room" value="2">ベッドルーム
90
+
91
+ </p>
92
+
93
+ <p>
94
+
95
+ <input type="radio" name="book" value="1">小説
96
+
97
+ <input type="radio" name="book" value="2">ビジネス
98
+
99
+ </p>
100
+
101
+ <input type="submit" value="移動">
102
+
103
+ </form>
104
+
105
+ ```
106
+
107
+
108
+
109
+ euledgeさんに教えて頂いた内容で以下の様にして
110
+
111
+ リンクをつける事はクリアできました!ありがとうございます!
112
+
113
+ ```
114
+
115
+ <script language="JavaScript">
116
+
117
+ function link() {
118
+
119
+ if ( document.form1.room[0].checked == true && document.form1.book[0].checked == true )
120
+
121
+ window.location.href =("01.html")
122
+
123
+ if ( document.form1.room[0].checked == true && document.form1.book[1].checked == true )
124
+
125
+ window.location.href =("02.html")
126
+
127
+ if ( document.form1.room[1].checked == true && document.form1.book[0].checked == true )
128
+
129
+ window.location.href =("03.html")
130
+
131
+ if ( document.form1.room[1].checked == true && document.form1.book[1].checked == true )
132
+
133
+ window.location.href =("04.html")
134
+
135
+ }
136
+
137
+ </script>
138
+
139
+
140
+
141
+ <form name="form1" method="post" target="_blank">
142
+
143
+ <p>
144
+
145
+ <input type="radio" name="room">リビング
146
+
147
+ <input type="radio" name="room">ベッドルーム
148
+
149
+ </p>
150
+
151
+ <p>
152
+
153
+ <input type="radio" name="book">小説
154
+
155
+ <input type="radio" name="book">ビジネス
156
+
157
+ </p>
158
+
159
+ <input type="button" value="移動" onclick="link()">
160
+
161
+ </form>
162
+
163
+ ```