javascriptが動作しないです。
下記のコード(index.html)を実行し、classの「box」をクリックしても、背景色が変化しないです。
OSはwindows10で、エディターはvscodeを使用しています。
実行環境は、xamppです。
php
1<!DOCTYPE html> 2<html lang="ja"> 3<head> 4 <meta charset="utf-8"> 5 <title>JavaScript Practice</title> 6 <style> 7 .box { 8 width: 100px; 9 height: 100px; 10 background: skyblue; 11 cursor: pointer; 12 } 13 </style> 14</head> 15<body> 16 <div id="target" class="box"></div> 17 18 <script> 19 'use strict'; 20 21 document.getElementById('target').addEventListener('click', function() { 22 document.getElementById('target').style.background = 'pink'; 23 }); 24 </script> 25</body> 26</html>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/05/05 08:25
2019/05/05 08:26
2019/05/05 08:27
2019/05/05 08:30
2019/05/05 08:35
2019/05/05 08:43
2019/05/05 08:48
2019/05/05 09:54
2019/05/06 01:08
2019/05/06 01:18
2019/05/06 01:25
2019/05/06 01:50