IE中的settimeout

时间:2011-05-16 12:06:51

标签: javascript

  

可能重复:
  set time out in JavaScript

我在IE中获得了以下代码的无效参数:

<SCRIPT type="text/javascript"> 
if (document.getElementById("safeForm9c").submitted.value == "false") {
    document.getElementById("safeForm9c").submitted.value = "true";
    setTimeout(document.getElementById("safeForm9c").submit(), 100);
}else{
document.getElementById("toHide").style.display="none";
}
/</SCRIPT> 

问题是什么?

整个代码:

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\" ><!--/*--><![CDATA[/*><!--*/\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("if(Wicket.Browser.isIE()){ \n");
          buffer.append("setTimeout(document.getElementById(\"").append(component.getMarkupId()).append("\").submit(), 100);\n");
          buffer.append("} else {");
          buffer.append("\n setTimeout('document.getElementById(\"").append(component.getMarkupId()).append("\").submit()', 100);}\n");
          buffer.append("\n}else{\n document.getElementById(\"toHide\").style.display=\"none\";\n}/*-->]]>*/</script>");      
          component.getResponse().write(buffer);        
    }  
  } 

 redirectLink.add(new Label("redirectToMainPage", GeneralTranslation.getInstance().getValue("redirect.to.home", TranslatorType.GUI, this)));
    redirectLink.setVisible(false);
    this.add(redirectLink);    
    this.add(new GenericMiniBasketPanel("genericMiniBasketPanel"));
    safeForm.add(new SafeSubmitBehaviour());

0 个答案:

没有答案