form的提交,onclick()函数,手动提交

当form的提交不是  <input type="submit" value="提交" >  时,而是图片时,这是我们就要变换思维了,看下面--

<table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td width="21%" height="30">
<div align="center">
<span class="STYLE3">用户</span>
</div>

</td>
<td width="79%" height="30">
<input type="text" name="username" 
style="height: 18px; width: 130px; border: solid 1px #cadcb2; font-size: 12px; color: #81b432;">
</td>
</tr>
<tr>
<td height="30">
<div align="center">
<span class="STYLE3">密码</span>
</div>

</td>
<td height="30">
<input type="password" name="password"
style="height: 18px; width: 130px; border: solid 1px #cadcb2; font-size: 12px; color: #81b432;">
</td>
</tr>
<tr>
<td height="30">
&nbsp;
</td>
<td height="30">
<img src="images/dl.gif" width="81" height="22"
border="0" usemap="#Map">
</td>

</tr>
</table>

      .....................................................

<map name="Map">
<area shape="rect" coords="3,3,36,19"href="# ">
<area shape="rect" coords="40,3,78,18" href="#">
</map>

在struts2中,action怎么获得uname,pwd ?

<script type="text/javascript">  
    function submitForm() {  
        with (document.getElementById("loginform")) {  
            submit();  
        }  
    }  
</script>

<form action="login.action" method="post" name="loginform" id="loginform">

<table>

...................

</table>
</form>

<map name="Map">
<area shape="rect" coords="3,3,36,19" οnclick="submitForm()">
<area shape="rect" coords="40,3,78,18" href="#">
</map>

笔者学习struts2刚刚一个星期,就遇到这种问题,整整纠结了一晚上......才想到绕过from的<input type="submit" value="提交" >.....

其实还有更简单的

<!--图像按钮-->
  <input type="image" src = "btn.png">

希望后面的学习者有个参考。




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值