質問編集履歴

4

修正完了

2019/04/19 09:11

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -58,63 +58,79 @@
58
58
 
59
59
 
60
60
 
61
- $(function() {
61
+ $(function() {
62
62
 
63
63
 
64
64
 
65
- //type1
65
+ //type1
66
66
 
67
- $("#A").on("click", function() {
67
+ $("#A").on("click", function() {
68
68
 
69
- $("#type1").text($("#A").val());
69
+ $("#type1").text($("#A").val());
70
70
 
71
71
 
72
+
73
+ });
74
+
75
+
76
+
77
+ $("#A1").on("click", function() {
78
+
79
+ $("#type1").text($("#A1").val());
80
+
81
+
82
+
83
+ });
84
+
85
+
86
+
87
+ //type2
88
+
89
+ $("#B").on("click", function() {
90
+
91
+ $("#type2").text($("#B").val());
92
+
93
+
94
+
95
+ });
96
+
97
+
98
+
99
+ $("#B1").on("click", function() {
100
+
101
+ $("#type2").text($("#B1").val());
102
+
103
+
104
+
105
+ });
72
106
 
73
107
  });
74
108
 
75
109
 
76
110
 
77
- $("#A1").on("click", function() {
111
+
78
112
 
113
+
114
+
115
+ $(function(){
116
+
79
- $("#type1").text($("#A1").val());
117
+ $(":radio").on('change', function(){
118
+
119
+
120
+
121
+ const a = document.getElementById('mailto');; // <a>要素
122
+
123
+ const type1 = document.querySelector('#type1').textContent;
124
+
125
+ const type2 = document.querySelector('#type2').textContent;
126
+
127
+ a.setAttribute('href', 'mailto:?body=TYPE1→' + encodeURIComponent(type1 + '\nTYPE2→' + type2));
80
128
 
81
129
 
82
130
 
83
- });
131
+ });
84
-
85
-
86
-
87
- //type2
88
-
89
- $("#B").on("click", function() {
90
-
91
- $("#type2").text($("#B").val());
92
-
93
-
94
132
 
95
133
  });
96
-
97
-
98
-
99
- $("#B1").on("click", function() {
100
-
101
- $("#type2").text($("#B1").val());
102
-
103
-
104
-
105
- });
106
-
107
- });
108
-
109
-
110
-
111
- const a = document.getElementById('mailto');; // <a>要素
112
-
113
- const type1 = document.querySelector('#type1').textContent;
114
-
115
- const type2 = document.querySelector('#type2').textContent;
116
-
117
- a.setAttribute('href', 'mailto:?body=' + encodeURIComponent(type1 + '\n' + type2));
118
134
 
119
135
 
120
136
 

3

修正

2019/04/19 09:11

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -18,8 +18,6 @@
18
18
 
19
19
 
20
20
 
21
-
22
-
23
21
  <input id="A" type="radio" name="ch1" onclick="sample();" value="A">A
24
22
 
25
23
  <input id="A1" type="radio" name="ch1" onclick="sample();" value="A1">A1
@@ -30,7 +28,7 @@
30
28
 
31
29
  <input id="B1" type="radio" name="cc1" onclick="sample()" value="B1">B1
32
30
 
33
-
31
+
34
32
 
35
33
  <br><br>
36
34
 
@@ -42,7 +40,7 @@
42
40
 
43
41
 
44
42
 
45
- <a href="mailto:?body=TYPE1→ここにAを引用したいです%0d%0aTYPE2→ここにBを引用したいです">メールソフトを立ち上げる</a>
43
+ <a id="mailto" href="mailto:?body=TYPE1→ここにAを引用したいです%0d%0aTYPE2→ここにBを引用したいです">メールソフトを立ち上げる</a>
46
44
 
47
45
 
48
46
 
@@ -110,6 +108,16 @@
110
108
 
111
109
 
112
110
 
111
+ const a = document.getElementById('mailto');; // <a>要素
112
+
113
+ const type1 = document.querySelector('#type1').textContent;
114
+
115
+ const type2 = document.querySelector('#type2').textContent;
116
+
117
+ a.setAttribute('href', 'mailto:?body=' + encodeURIComponent(type1 + '\n' + type2));
118
+
119
+
120
+
113
121
  </script>
114
122
 
115
123
  ```

2

修正

2019/04/18 22:49

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -16,13 +16,37 @@
16
16
 
17
17
  ```HTML
18
18
 
19
- <div class="type1">A</div>
20
-
21
- <div class="type2">B</div>
22
19
 
23
20
 
24
21
 
22
+
23
+ <input id="A" type="radio" name="ch1" onclick="sample();" value="A">A
24
+
25
+ <input id="A1" type="radio" name="ch1" onclick="sample();" value="A1">A1
26
+
27
+
28
+
29
+ <input id="B" type="radio" name="cc1" onclick="sample()" value="B">B
30
+
31
+ <input id="B1" type="radio" name="cc1" onclick="sample()" value="B1">B1
32
+
33
+
34
+
35
+ <br><br>
36
+
37
+
38
+
39
+ type1<div id="type1">選んでください</div>
40
+
41
+ type2<div id="type2">選んでください</div>
42
+
43
+
44
+
25
- <a href="mailto:?body=TYPE1→ここにAを引用したいです%0d%0aTYPE2→ここにBを引用したいです">メールソフトを立ち上げる</a>
45
+ <a href="mailto:?body=TYPE1→ここにAを引用したいです%0d%0aTYPE2→ここにBを引用したいです">メールソフトを立ち上げる</a>
46
+
47
+
48
+
49
+
26
50
 
27
51
  ```
28
52
 

1

修正

2019/04/17 05:37

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
 
16
16
 
17
- ```ここに言語を入力
17
+ ```HTML
18
18
 
19
19
  <div class="type1">A</div>
20
20
 
@@ -28,6 +28,72 @@
28
28
 
29
29
 
30
30
 
31
+ ```script
32
+
33
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
34
+
35
+ <script>
36
+
37
+
38
+
39
+ $(function() {
40
+
41
+
42
+
43
+ //type1
44
+
45
+ $("#A").on("click", function() {
46
+
47
+ $("#type1").text($("#A").val());
48
+
49
+
50
+
51
+ });
52
+
53
+
54
+
55
+ $("#A1").on("click", function() {
56
+
57
+ $("#type1").text($("#A1").val());
58
+
59
+
60
+
61
+ });
62
+
63
+
64
+
65
+ //type2
66
+
67
+ $("#B").on("click", function() {
68
+
69
+ $("#type2").text($("#B").val());
70
+
71
+
72
+
73
+ });
74
+
75
+
76
+
77
+ $("#B1").on("click", function() {
78
+
79
+ $("#type2").text($("#B1").val());
80
+
81
+
82
+
83
+ });
84
+
85
+ });
86
+
87
+
88
+
89
+ </script>
90
+
91
+ ```
92
+
93
+
94
+
95
+
96
+
31
97
  調べてはみたのですが、わかりませんでした。。
32
98
 
33
99
  すみませんが、ご教授いただければ嬉しいです。何卒宜しくお願い申し上げます。