我有一个叫做formFill()的函数,我希望它在完成后提交表单。眼下的功能是通过一个onclick这样的专区内运行:表单提交onclick函数
<div class="stormData" onClick="formFill('11-04-14','11-04-14','TX','none');">11-04-14 - TX</div>
这工作得很好,但我想要的功能,提交表单也让我加入document.theform.submit();到功能,它不起作用。这是我的功能。
function formFill(a, b, c, d){
theform.from.value = a;
theform.to.value = b;
if(d != "none"){
theform.kmlFile.value = d;
theform.hailswath.checked = true;
document.getElementById("kmlLabel").innerHTML = d;
}
for(var i = 0;i < document.getElementById("stateSelect").length;i++){
if(document.getElementById("stateSelect").options[i].value == c){
document.getElementById("stateSelect").selectedIndex = i;
}
}
document.theform.submit();
}
哪个浏览器?你会得到一个JavaScript错误,并且你的页面是以怪癖模式还是标准模式呈现(什么是DOCTYPE)? – PleaseStand 2011-04-18 21:57:23