回答編集履歴

1

sample

2016/10/06 05:36

投稿

yambejp
yambejp

スコア114583

test CHANGED
@@ -1,5 +1,39 @@
1
1
  idやclassをつけた上で、cssで指定してはいけないのでしょうか?
2
2
 
3
- buttonに直接hoverを指定するのであれば、onmouseoverとonmouseoutを指定するのでしょうけど
3
+ buttonに直接hoverを指定するのであれば、onmouseoverとonmouseoutを
4
4
 
5
- それはそれで面倒です
5
+ 指定するのでしょうけどそれはそれで面倒です
6
+
7
+
8
+
9
+ # 追記
10
+
11
+ 一応onmouseover/outの例だけ上げておきます
12
+
13
+
14
+
15
+ ```javascript
16
+
17
+ <form></form>
18
+
19
+ <script>
20
+
21
+ var form = document.getElementsByTagName('form');
22
+
23
+ var btn = document.createElement('button');
24
+
25
+ btn.style = 'width: 50px';
26
+
27
+ btn.textContent = 'button';
28
+
29
+ btn.addEventListener ('mouseover',function(){this.style.boxShadow="0 7px 0 #f7ba59";});
30
+
31
+ btn.addEventListener ('mouseout',function(){this.style.boxShadow="";});
32
+
33
+ form[0].appendChild(btn);
34
+
35
+ </script>
36
+
37
+
38
+
39
+ ```