当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">
</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">
希望后面的学习者有个参考。