javascript中实现按不同按钮跳转到不同页面1
发布网友
发布时间:2023-10-30 01:27
我来回答
共2个回答
热心网友
时间:2023-11-10 03:50
<!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>
热心网友
时间:2023-11-10 03:50
<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属性
希望可以帮到你!!!