質問編集履歴
2
修正しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,12 @@
|
|
1
1
|
以下のプログラムでフォームに入力した値を取得して関数の中でdocument.writeで文字列として表示したいです。値を取得する方法は調べてなんとかなりそうなのですが、どこにそのコードを書けばいいのかわかりません。function zやa,bの中に書くと固まってしまいます。どなたか教えていただけないでしょうか?
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
追記
|
6
|
+
|
7
|
+
フォームの値を取得して表示できるようにはなったのですが、そうするとfunction zが動きません
|
8
|
+
|
9
|
+
...
|
2
10
|
|
3
11
|
|
4
12
|
|
@@ -14,7 +22,9 @@
|
|
14
22
|
|
15
23
|
|
16
24
|
|
25
|
+
```
|
26
|
+
|
17
|
-
|
27
|
+
<form name="text">
|
18
28
|
|
19
29
|
|
20
30
|
|
@@ -24,7 +34,9 @@
|
|
24
34
|
|
25
35
|
|
26
36
|
|
27
|
-
</form>
|
37
|
+
</form>
|
38
|
+
|
39
|
+
```
|
28
40
|
|
29
41
|
|
30
42
|
|
@@ -36,7 +48,9 @@
|
|
36
48
|
|
37
49
|
|
38
50
|
|
51
|
+
```
|
52
|
+
|
39
|
-
|
53
|
+
function deleteInsertTag() {document.close();
|
40
54
|
|
41
55
|
var insertTag = document.getElementById("insertTag");
|
42
56
|
|
@@ -46,13 +60,21 @@
|
|
46
60
|
|
47
61
|
}
|
48
62
|
|
63
|
+
}
|
64
|
+
|
49
|
-
|
65
|
+
```
|
66
|
+
|
67
|
+
|
50
68
|
|
51
69
|
|
52
70
|
|
53
71
|
//関数をランダムに実行
|
54
72
|
|
73
|
+
|
74
|
+
|
75
|
+
```
|
76
|
+
|
55
|
-
|
77
|
+
function z(){
|
56
78
|
|
57
79
|
funcName=["a","b"];
|
58
80
|
|
@@ -62,7 +84,9 @@
|
|
62
84
|
|
63
85
|
eval(funcName[n])();
|
64
86
|
|
87
|
+
}
|
88
|
+
|
65
|
-
|
89
|
+
```
|
66
90
|
|
67
91
|
|
68
92
|
|
@@ -70,7 +94,9 @@
|
|
70
94
|
|
71
95
|
|
72
96
|
|
97
|
+
```
|
98
|
+
|
73
|
-
|
99
|
+
function a(){
|
74
100
|
|
75
101
|
deleteInsertTag();
|
76
102
|
|
@@ -78,13 +104,17 @@
|
|
78
104
|
|
79
105
|
|
80
106
|
|
81
|
-
document.write('<a id="insertTag" href="#" onclick="z()"><img src="2016-06-18 19.46.54.jpg"/></a>'); document.write("aaa");}
|
107
|
+
document.write('<a id="insertTag" href="#" onclick="z()"><img src="2016-06-18 19.46.54.jpg"/></a>'); document.write("aaa");}
|
108
|
+
|
109
|
+
```
|
82
110
|
|
83
111
|
|
84
112
|
|
85
113
|
|
86
114
|
|
115
|
+
```
|
116
|
+
|
87
|
-
|
117
|
+
function b()
|
88
118
|
|
89
119
|
|
90
120
|
|
@@ -92,7 +122,9 @@
|
|
92
122
|
|
93
123
|
deleteInsertTag();
|
94
124
|
|
95
|
-
document.write('<a id="insertTag" href="#" onclick="z()"><img src="2016-06-18 19.46.06.jpg"/></a>');document.write("vvvv");}
|
125
|
+
document.write('<a id="insertTag" href="#" onclick="z()"><img src="2016-06-18 19.46.06.jpg"/></a>');document.write("vvvv");}
|
126
|
+
|
127
|
+
```
|
96
128
|
|
97
129
|
|
98
130
|
|
@@ -100,11 +132,11 @@
|
|
100
132
|
|
101
133
|
|
102
134
|
|
103
|
-
|
135
|
+
```<style>
|
104
136
|
|
105
137
|
img {width:100%;}
|
106
138
|
|
107
|
-
</style>
|
139
|
+
</style>```
|
108
140
|
|
109
141
|
|
110
142
|
|
1
更新しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,7 +12,9 @@
|
|
12
12
|
|
13
13
|
<body>
|
14
14
|
|
15
|
+
|
16
|
+
|
15
|
-
<form name="text">
|
17
|
+
'''<form name="text">
|
16
18
|
|
17
19
|
|
18
20
|
|
@@ -22,7 +24,9 @@
|
|
22
24
|
|
23
25
|
|
24
26
|
|
25
|
-
</form>
|
27
|
+
</form>'''
|
28
|
+
|
29
|
+
|
26
30
|
|
27
31
|
<script>
|
28
32
|
|
@@ -30,7 +34,9 @@
|
|
30
34
|
|
31
35
|
// 削除処理
|
32
36
|
|
37
|
+
|
38
|
+
|
33
|
-
function deleteInsertTag() {document.close();
|
39
|
+
'''function deleteInsertTag() {document.close();
|
34
40
|
|
35
41
|
var insertTag = document.getElementById("insertTag");
|
36
42
|
|
@@ -40,13 +46,13 @@
|
|
40
46
|
|
41
47
|
}
|
42
48
|
|
43
|
-
}
|
49
|
+
}'''
|
44
50
|
|
45
51
|
|
46
52
|
|
47
53
|
//関数をランダムに実行
|
48
54
|
|
49
|
-
function z(){
|
55
|
+
'''function z(){
|
50
56
|
|
51
57
|
funcName=["a","b"];
|
52
58
|
|
@@ -56,7 +62,7 @@
|
|
56
62
|
|
57
63
|
eval(funcName[n])();
|
58
64
|
|
59
|
-
}
|
65
|
+
}'''
|
60
66
|
|
61
67
|
|
62
68
|
|
@@ -64,7 +70,7 @@
|
|
64
70
|
|
65
71
|
|
66
72
|
|
67
|
-
function a(){
|
73
|
+
'''function a(){
|
68
74
|
|
69
75
|
deleteInsertTag();
|
70
76
|
|
@@ -72,11 +78,13 @@
|
|
72
78
|
|
73
79
|
|
74
80
|
|
75
|
-
document.write('<a id="insertTag" href="#" onclick="z()"><img src="2016-06-18 19.46.54.jpg"/></a>'); document.write("aaa");}
|
81
|
+
document.write('<a id="insertTag" href="#" onclick="z()"><img src="2016-06-18 19.46.54.jpg"/></a>'); document.write("aaa");}'''
|
76
82
|
|
77
83
|
|
78
84
|
|
85
|
+
|
86
|
+
|
79
|
-
function b()
|
87
|
+
'''function b()
|
80
88
|
|
81
89
|
|
82
90
|
|
@@ -84,7 +92,7 @@
|
|
84
92
|
|
85
93
|
deleteInsertTag();
|
86
94
|
|
87
|
-
document.write('<a id="insertTag" href="#" onclick="z()"><img src="2016-06-18 19.46.06.jpg"/></a>');document.write("vvvv");}
|
95
|
+
document.write('<a id="insertTag" href="#" onclick="z()"><img src="2016-06-18 19.46.06.jpg"/></a>');document.write("vvvv");} '''
|
88
96
|
|
89
97
|
|
90
98
|
|
@@ -92,11 +100,13 @@
|
|
92
100
|
|
93
101
|
|
94
102
|
|
95
|
-
<style>
|
103
|
+
'''<style>
|
96
104
|
|
97
105
|
img {width:100%;}
|
98
106
|
|
99
|
-
</style>
|
107
|
+
</style>'''
|
108
|
+
|
109
|
+
|
100
110
|
|
101
111
|
</body>
|
102
112
|
|