我有方法settimeout,图像在IE和FF中使用动态操作进行编码,但它不会进入下一页。
static private class SafeSubmitBehaviour extends AbstractBehavior{
public void onRendered( Component component ) {
super.onRendered( component );
StringBuffer buffer = new StringBuffer(200);
buffer.append("<script type=\"text/javascript\" >\n");
buffer.append("if (document.getElementById(\"").append(component.getMarkupId()).append("\").submitted.value == \"false\") {\n");
buffer.append("document.getElementById(\"").append(component.getMarkupId()).append("\").submitted.value = \"true\";\n");
buffer.append("setTimeout('document.getElementById(\"").append(component.getMarkupId()).append("\").submit()', 100);\n}else{\n");
buffer.append("document.getElementById(\"toHide\").style.display=\"none\";\n}]]>*/</script>");
component.getResponse().write(buffer);
}
}
HTML:
<div id="toHide" class="pb-text-align-center">
<img style="display: inline" src="img/load.gif" />
<form wicket:id="safeForm" class="clearfix">
<input type="hidden" wicket:id="submitted" value="false" />
</form>
</div>
我该如何解决这个问题?我的问题是带有动画的图像不能用于IE,但是用FF工作正常。
来自html视图源的Java脚本功能:
if (document.getElementById("safeForm4d").submitted.value == "false") {
document.getElementById("safeForm4d").submitted.value = "true";
setTimeout(function(){'document.getElementById("safeForm4d").submit()'}, 100);
}else{
document.getElementById("toHide").style.display="none";
}