1. 程式人生 > >一個form中有兩個submit

一個form中有兩個submit

<!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=utf-8" />
<title>無標題文件</title>
</head>


<body>


<script type="text/javascript">
function submitFun(act)
{
myForm.action.value = act;
myForm.submit();
}
</script>


<form name="myForm">
<input type="hidden" name="action" value="edit">
<input type="button" name="editBtn" value="修改" onclick="submitFun('edit');">
<input type="button" name="delBtn" value="刪除" onclick="submitFun('del');">
</form> 
</body>

</html>

<!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=utf-8" />
<title>無標題文件</title>
</head>


<body><script type="text/javascript">
function check(){
frm.action = "checkname.jsp"
}
function mysubmit() {
frm.action = "zhuce.jsp"
}
</script>
<form method=post action="" name="frm">
<input type="submit" onclick="check()">
<input type="submit" onclick="mysubmit()">
</form>
</body>
</html>