javascript中实现按不同按钮跳转到不同页面

form下有三个按钮,如何实现点删除跳转到删除页面,点击修改跳转到修改页面?action=该怎么写?
<form method="post" action="删除页面或修改页面">
<div class="buttons">
<input type="submit" name="submit" value="修改" class="input-button" onclick="return isup();" />
<input type="submit" name="submit" value="删除" class="input-button" onclick="return isdel();" />
<input type="button" name="button" value="返回" class="input-button" onclick="history.back();"/>
</div>

<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8" />
<title>pro.html</title>
<style type="text/css">
</style>
<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
<script type="text/javascript">
var guys = function (val) 
{
var form = document.form;
if (val == '修改')
        {
        form.action = '修改.html';
        }
else if (val == '删除')
        {
        form.action = '删除.html';
        }
else if (val == '返回')
        {
        form.action = '返回.html';
        }
return true;
}
</script>
</head>
<body>
<form name="" method="post" action="删除页面或修改页面">
<div class="buttons">
<input type="submit" name="submit" value="修改" class="input-button" onclick="return guys(this.value);" /> 
<input type="submit" name="submit" value="删除" class="input-button" onclick="return guys(this.value);" />
<input type="button" name="button" value="返回" class="input-button" onclick="history.guys(this.value);" />
</div>
</form>
</body>
</html>

温馨提示:内容为网友见解,仅供参考
第1个回答  推荐于2016-01-26
<div class="buttons">
<form id="forml" method="post" action="">

<input type="submit" onclick="xiugai()" name="submit" value="修改" class="input-button" onclick="return isup();" />
<input type="submit" onclick="shanchu()" name="submit" value="删除" class="input-button" onclick="return isdel();" />
<input type="button" name="button" value="返回" class="input-button" onclick="history.back();"/>
</form>
</div>
<script type="text/javascript">
function xiugai(){
form1 = document.getElementById("forml");
form1.action = "xiugai.html";
}
function shanchu(){
form1 = document.getElementById("forml");
form1.action = "shanchu.html";
}
</script>

//写js,当点击修改这个按钮时改变form里面的action属性
希望可以帮到你!!!本回答被提问者采纳
相似回答