前提・実現したいこと
######分かるかた見えましたらご教授下さい
clearIntervalしたfunctionを再開させたい
発生している問題・エラーメッセージ
Uncaught TypeError: interval is not a function
javascript /javatest.js
let stock = ['niku','susi','uni','stake'] const interval = setInterval(function(){ stock.forEach(function(data,index){ const idname = index; document.getElementById(idname).innerHTML = data; }); const first = stock.shift(); stock.push(first); }, 200); document.getElementById('stop').onclick = function(){ clearInterval(interval); } document.getElementById('start').onclick = interval();
HTML
<!DOCTYPE html> <main> <div id = rensyuu> <div id = 0></div> <div id = 1></div> <div id = 2></div> <div id = 3></div> </div> <p><button id = stop>止める</btn></p> <p><button id = start>スタート</btn></p> </main> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <head> </head> <body> <script src = "javatest.js"></script> <script> </script> </body> </html>

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/07/14 04:13