小编ry0*_*000的帖子

Javascript img change语句太火了

我正在制作Nest的Smoke和一氧化碳报警巢保护模拟器.但是当我按下按钮(点击)时,内圈不会像预期的那样变成蓝色.它说话,因为我使用了ResponsiveVoice,但它只是没有点亮!这是我的(未完成的)代码.

<script src="http://code.responsivevoice.org/responsivevoice.js"></script>    
<script>
function delay(millis)  {
    var date = new Date();
    var curDate = null;
    do { curDate = new Date(); }
    while(curDate-date < millis);
}
function press() {
    document.getElementById("unit").src = "assets/img/blue.jpg";
    delay(500);
    responsiveVoice.speak("Ready. In the Living Room. Press to test.");
    delay(500);
    document.getElementById("unit").src = "assets/img/idle.jpg";


}
</script>
Run Code Online (Sandbox Code Playgroud)

javascript responsivevoice

3
推荐指数
1
解决办法
119
查看次数

标签 统计

javascript ×1

responsivevoice ×1