button,submit, image的区别 点onclick后隐藏行
<input type="button" name="Submit" value="显示表单button" onclick="showAddData()"/>
<input type="submit" name="Submit" value="显示表单submit" onclick="showAddData()"/>
<input type="image" alt="add" src="<%=request.getContextPath() %>/images/btnImg/btn_add.gif" onclick="showAddData()" />
------------------------------
1. type="button" onclick=onclick="showAddData()" 不会提交页面,只对按钮有效.
2. type="submit" onclick=onclick="showAddData()" 会提交页面
3. type="image" onclick=onclick="showAddData()" 会提交页面
---------------------------------
例:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>关于“显示表单”与“关闭表单”的演示</title>
<script type="text/javascript">
function showform()
{
document.getElementById("lizi").style.display="block";
}
function closeform()
{
document.getElementById("lizi").style.display="none";
}
</script>
</head>
<body>
<form id="form2" name="form2" method="post" action="">
<table width="98%" border="1" cellspacing="0" cellpadding="0" >
<tr>
<td height="68"><label>
<input type="button" name="Submit" value="显示表单" onclick="showform()"/>
<input type="button" name="Submit2" value="关闭表单" onclick="closeform()"/>
</label></td>
</tr>
<tr>
<td height="63">wwwwww</td>
</tr>
<tr id="lizi" style="display: none;">
<td height="63"><input type="text" name="test" value="aaa" /></td>
</tr>
</table>
</form>
</body>
</html>