【问题标题】:turn on android LED light "enabletorch" for X amount of time?打开 android LED 灯“enabletorch”X 时间?
【发布时间】:2013-02-07 11:20:52
【问题描述】:

我有下面的代码,每次单击按钮时,我的手机 LED 都会闪烁,但我还需要 LED 在 3 秒后自动关闭。不知道怎么做,请帮忙。

input type="button" onclick="ipwajax('enabletorch')" value="打开LED"

【问题讨论】:

    标签: led flashlight


    【解决方案1】:

    假设ipwajax('enabletorch') 启用 LED,ipwajax('disabletorch') 禁用它,你会想要类似的东西

    <script language="JavaScript">
    
      function enableTorch(milliSeconds) {
        ipwajax('enabletorch');
        window.setTimeout("ipwajax('disabletorch');",milliSeconds);
      }
    
    </script>
    
    <input type="button" onclick="enableTorch(3000);" value="Turn on LED">
    

    【讨论】:

    • 所以我只是用你上面给我的所有东西替换: input type="button" onclick="ipwajax('enabletorch')" value="Turn on LED" ,它应该可以工作吗?
    • 最好将函数移动到顶部脚本块,但即使这样也应该可以工作。
    • 非常感谢,我现在需要测试一下。真的希望它有效。你是最棒的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-15
    • 2011-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-29
    • 1970-01-01
    相关资源
    最近更新 更多