如何切换2个画布

时间:2016-11-06 00:45:35

标签: canvas toggle

我想浏览画布页面,我尝试使用此代码,但它们给了我一个错误;

        if (e.keycode == 13) {
            theCanvas.style.visibility == 'visible'
            theCanvas.style.visibility = 'hidden';
            theCanvas1.style.visibility = 'visible';
        } else {
            theCanvas.style.visibility = 'visible';
            theCanvas1.style.visibility = 'hidden';
        }
    });

1 个答案:

答案 0 :(得分:0)

试试这个

        if (e.keycode == 13) {
            theCanvas.style.visibility = 'hidden';
            theCanvas1.style.visibility = 'visible';
    });

不需要else,只需要主要的if语句

希望它能帮助mukund2003