……
<span id="bizResult" style="color: red"></span>
……
<input class="button" type="button" value="<%=resource.srcStr("Main.submit")%>" onclick="$('bizResult').innerHTML='请等待……',checkForm()">
如上所示,在单击button之后,先是设置id为bizResult的span值为“请等待……”,然后执行js的checkForm(),将执行结果再写入到span中,但在实际执行时,span并没有显示“请等待……”若修改代码,添加一个定时函数,将时间设为0:……
<span id="bizResult" style="color: red"></span>
……
<input class="button" type="button" value="<%=resource.srcStr("Main.submit")%>" onclick="$('bizResult').innerHTML='请等待……',setTimeout('checkForm()',0)">
这样就可以实现我想要的功能,但这是为什么呢?