我的脚本和idk中存在问题,可能textContent在Google Chrome中无效,以下是代码:
function afficher_temps() {
var $ = unsafeWindow.$;
var temps = document.getElementsByClassName('time hidden')[0].textContent;
if(document.getElementById('temps')) {
document.getElementById('temps').innerHTML = temps;
}
else {
$('#banner').append('<br /><br /><dt id="temps">'+temps+'</dt>');
}
setTimeout(afficher_temps, 1000);
}
afficher_temps();
我想提取的时间在这里:
<p class="time hidden" style="display: block; ">Time remaining:<br>1:10:07</p>
而且如果时间是00:00:05,我想要点击一个按钮:
<input class="Button1" type="button" style="padding: 10px" value="OK!">
非常感谢!
答案 0 :(得分:0)
我经常遇到使用setTimeout的问题。在你的情况下,我建议以这种方式使用setTimeout:
setTimeout("afficher_temps", 1000);
或
setTimeout(function(){
afficher_temps();
}, 1000);
也许这可以解决一些问题。再见