2010-04-01 79 views
0

选择Onchage我打电话一个javascript使用struts1.2使服务器的呼叫,但它不是作出call.Please让我知道我错了,是代码下面的JavaScript服务器问题

<html:form action="/populate"> 
    <html:select property="tName" onchange="test()">"> 
     <html:option value="">SELECT</html:option> 
     <html:options name="tList" /> 
    </html:select> 
</html:form> 

和stuts,配置有

<action path="/populate" name="tForm" type="com.testAction" validate="false" parameter="method" scope="request" > 
    <forward name="success" path="/failure.jsp" /> 
</action> 

和JavaScript是

function test(){ 
    var selObj = document.getElementById("tName"); 
    var selIndex = selObj.selectedIndex; 
    if (selIndex != 0) { 
     document.form[0].selIndex.action="/populate.do?method=execute&testing="+selIndex; 
     document.form[0].submit(); 
    } 
} 

回答

1

文件。 形式 - 复数。

+0

还不曾 – sarah 2010-04-01 05:34:16

0
document.forms[0].action="..."; // (don't need "selIndex" in there) 
+0

雅以其优良的,现在我越来越/填充不可用,即使映射是在有XML – sarah 2010-04-01 05:45:59

+0

你需要一个支柱的家伙。 :-) – roufamatic 2010-04-01 05:58:00