搞了一天了,烦死了!
struts form里面怎么用javascript来submit啊??
譬如
<html:form action= "/dateManage.do ">
<html:button property= "button1 " />
<html:button property= "button2 " />
</html:form>
我希望在最后ActionBean中得到是哪个按钮来submit的?
我应该怎么写js代码来submit啊?今天写了一天都没有搞定。谢谢告知~
------解决方案-------------------- <html:button property= "button1 " onclick= "javascript:submitForm() " />
<script>
function submitForm(){
document.forms[0].submit();
}
</script>
------解决方案--------------------这个可以另外添加一个参数,比如dateManage.do?command=delete&xxx=ccc...
收到command=delete,就执行delete
可以隐藏一个input
<input type=hidden value= " " name=command id=command />
再加上js
<script>
function send(command){
document.getElementById( "command ").value = command;
}
</script>
然后2个按钮改为
<input type=button onclick=javascript:send( "delete "); />
<input type=button onclick=javascript:send( "insert "); /> ...
大概思路是这样子了
------解决方案-------------------- <input type= "button " value= "注册 " onclick= "this.form.optype.value= '注册 ';this.form.submit() " />
<input type= "button " value= "登录 " onclick= "this.form.optype.value= '登录 ';this.form.submit() " />
<input type= "button " value= "取消 " onclick= "this.form.optype.value= '取消 ';this.form.submit() " />