每个画布都在一个div容器内。每个div容器还在画布旁边包含一个段落。容器div在附加到主文档后为空。我也不知道为什么。另一件奇怪的事情是,如果我在附加容器div的部分后面插入以下代码来破坏应用程序,那么画布和段落也会被追加和可见两段:
var foo = some_var; //where some_var is undef
我试图通过在display:none和display:block之间切换来调整来自w3schools.com的函数,以切换div的可见性。margin-top: 20px;}
<p>Click the button to toggle between hiding and showing the DIV</