javascript中实现按不同按钮跳转到不同页面
form下有三个按钮,如何实现点删除跳转到删除页面,点击修改跳转到修改页面?action=该怎么写?<formmethod="post"action="删除页面或修改页面...
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> 展开
<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> 展开
2个回答
展开全部
<!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>
展开全部
<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属性
希望可以帮到你!!!
<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属性
希望可以帮到你!!!
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询