選擇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();
}
}
還不曾 – sarah 2010-04-01 05:34:16