<!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>一个form两个提交按钮,分别提交到两页面</title>
<script type="text/javascript">
function save()
{
document.form1.action="a.asp";
document.form1.submit();
}function send()
{
document.form1.action="b.asp";
document.form1.submit();
}
</script>
</head>
<body>
<form name="form1" method="post"> <!--method 必须写-->
<input type="text" name="username" value="scott">
<input type="button" value="发送" onclick="send();">
<input type="button" value="保存" onclick="save();">
</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>一个form两个提交按钮,分别提交到两页面</title>
<script type="text/javascript">
function send()
{
if (i==1)
{document.form1.action="b.asp";}
else
{document.form1.action="a.asp";}
document.form1.submit();
}
</script>
</head>
<body>
<form name="form1">
<input type="text" name="username" value="scott">
<input type="button" value="发送" onclick="send(0);">
<input type="button" value="保存" onclick="send(1);">
</form>
</body>
</html>